Skip to content
Snippets Groups Projects

Refactor: Generation of the finalize script

Merged Mikhail Karnevskiy requested to merge refactor/finalize_script into master
3 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
491 492 cell.source += "\n%config InlineBackend.figure_formats = ['svg']\n"
492 493
493 494
495 def create_finalize_script(fmt_args, temp_path, job_list):
496 """
497 Create a finalize script to produce output report
498 :param fmt_args: Dictionary of fmt arguments
499 :param temp_path: Path to temopary folder to run slurm job
500 :param job_list: List of slurm jobs
501 """
502 tmpl = Template('''
503 #!/bin/tcsh
504 source /etc/profile.d/modules.sh
505 module load texlive
506 echo 'Running finalize script'
507 python3 -c "from cal_tools.tools import finalize;
  • Karim Ahmed
  • 505 module load texlive
    506 echo 'Running finalize script'
    507 python3 -c "from cal_tools.tools import finalize;
    508 finalize({{joblist}}, $1, '{{run_path}}', '{{out_path}}',
    509 '{{project}}', '{{calibration}}', '{{author}}',
    510 '{{version}}', '{{report_to}}', '{{in_folder}}' )"
    511
    512 ''')
    513
    514 fmt_args['joblist'] = job_list
    515 f_name = "{}/finalize.sh".format(temp_path)
    516 with open(f_name, "w") as finfile:
    517 finfile.write(textwrap.dedent(tmpl.render(**fmt_args)))
    518
    519 all_stats = stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
    520 os.chmod(f_name, all_stats)
  • Karim Ahmed
  • 502 tmpl = Template('''
    503 #!/bin/tcsh
    504 source /etc/profile.d/modules.sh
    505 module load texlive
    506 echo 'Running finalize script'
    507 python3 -c "from cal_tools.tools import finalize;
    508 finalize({{joblist}}, $1, '{{run_path}}', '{{out_path}}',
    509 '{{project}}', '{{calibration}}', '{{author}}',
    510 '{{version}}', '{{report_to}}', '{{in_folder}}' )"
    511
    512 ''')
    513
    514 fmt_args['joblist'] = job_list
    515 f_name = "{}/finalize.sh".format(temp_path)
    516 with open(f_name, "w") as finfile:
    517 finfile.write(textwrap.dedent(tmpl.render(**fmt_args)))
  • added 12 commits

    Compare with previous version

  • Author Contributor

    Functionality was tested after re-basing on two notebooks.

  • added 1 commit

    • 0dea416b - Refactor generation of the finalize script

    Compare with previous version

  • mentioned in commit bc78a342

  • Please register or sign in to reply
    Loading