Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error message for failed submission, job id for successful submission #120

Merged
merged 12 commits into from
Aug 6, 2024
13 changes: 10 additions & 3 deletions utilix/batchq.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,23 @@ def submit(self) -> None:
# Add the job command
slurm.add_cmd(self.jobstring)

print(f"Your log is located at: {self.log}")

# Handle dry run scenario
if self.verbose or self.dry_run:
print(f"Generated slurm script:\n{slurm.script()}")

if self.dry_run:
return
# Submit the job
slurm.sbatch(shell="/bin/bash")

try:
job_id = slurm.sbatch(shell="/bin/bash")
if job_id:
print(f"Job submitted successfully. Job ID: {job_id}")
print(f"Your log is located at: {self.log}")
else:
print("Job submission failed.")
except Exception as e:
print(f"An error occurred while submitting the job: {str(e)}")


def submit_job(
Expand Down
Loading