Closed joaander closed 9 months ago
I tested this change with this script:
import signac
import flow
class Project(flow.FlowProject):
pass
@Project.operation
def operation(job):
pass
if __name__ == "__main__":
project = Project()
job = project.open_job({}).init()
project.submit(pretend=True)
Output before the change:
# Submit command: sbatch
#!/bin/bash
#SBATCH --job-name="Project/99914b932bd37a50b983c5e7c90ae93b/operation/4660846d0ccf58930f85a67b721b8dac"
#SBATCH --partition=standard
#SBATCH --nodes=1-1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --account=sglotzer9
set -e
set -u
cd /home/joaander/test/flow-submit-comment
# operation(99914b932bd37a50b983c5e7c90ae93b)
/home/joaander/miniforge3/bin/python /home/joaander/test/flow-submit-comment/submit.py run -o operation -j 99914b932bd37a50b983c5e7c90ae93b
# Eligible to run:
# /home/joaander/miniforge3/bin/python /home/joaander/test/flow-submit-comment/submit.py exec operation 99914b932bd37a50b983c5e7c90ae93b
Output after the change:
#!/bin/bash
#SBATCH --job-name="Project/99914b932bd37a50b983c5e7c90ae93b/operation/4660846d0ccf58930f85a67b721b8dac"
#SBATCH --partition=standard
#SBATCH --nodes=1-1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --account=sglotzer9
set -e
set -u
cd /home/joaander/test/flow-submit-comment
# operation(99914b932bd37a50b983c5e7c90ae93b)
/home/joaander/miniforge3/bin/python /home/joaander/test/flow-submit-comment/submit.py run -o operation -j 99914b932bd37a50b983c5e7c90ae93b
# Eligible to run:
# /home/joaander/miniforge3/bin/python /home/joaander/test/flow-submit-comment/submit.py exec operation 99914b932bd37a50b983c5e7c90ae93b
# Submit command: sbatch
Is the extra blank line intentional? I left it.
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
eb67b3f
) 69.27% compared to head (28f2dd9
) 69.25%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
codecov reports that processing failed, please ignore the failing report. This pull request does not change the test coverage.
Description
Move the submit command comment (i.e.
# Submit command: sbatch
) to the end of the pretend output.Motivation and Context
When testing, it is often convenient to save the output of
submit --pretend
and submit it manually. With# Submit command: sbatch
as the first line of output,python project.py submit -n 1 --pretend > file.sh
does produce a valid SLURM script. Moving the comment to the end preserves the information while creating a valid SLURM script that needs no further editing.Checklist: