Skip to content

Refactoring run-mmpol scripts

This encompasses many changes to the submit-pol-job and run-mmpol.sh that were originally pushed to rel_v0.1.1-1 but that branch got messed up. Reverting was going to be more work than creating a new release version. The level of changes in this merge have the qualities of a new minor release in any case so is warranted. All of the changes over three prior merge requests are listed below.

Major changes:

  • Added getopt functionality allowing the user to specify the following variables in the function call:
    • outdir: parent directory for the log to be placed in
    • output-log-prefix: the prefix to add to the policy file name to specify extra metadata
    • policy-file: path to the policy file
    • device: path or name of the target of the policy
  • Removed use of environment variables not explicitly set in the run-mmpol.sh script. These were also removed from the submit-pol-job script and replaced with the corresponding values to be explicitly passed
  • default policy file prefix is automatically created from the device path or name if not passed as an argument
  • Set user:group ownership to $USER:atlab.
  • Set permissions to rws for the containing directory and r-- for the log itself
  • Automatically gzip the log file
  • Implements changes suggested in #17 (closed). run-mmpol now creates a single directory to store the raw policy output, the split gz files, and the parquet files plus anything else associated with the run. The directory name matches the name of the log file.

Minor changes:

  • Changed some variable names to maintain consistency with related scripts
  • Full device path is used in the prefix, changing / to -. All metadata entries in the file/directory names are separated by _ for clarity
  • Added dry-run option to all 3 scripts for testing. Dry runs submit no jobs and make no changes to any directory structure.
  • Changed methods for finding the raw log once it's created and moving/renaming it
  • Removed default device from run-mmpol.sh. Now the device must be specified regardless of which script is run.

Syntax Changes:

  • Encased all called variables in "{}" for clarity in variable substitution.
  • Replaced ```` syntax with $() when performing command substitution

Issues Fixed:

Merge request reports