Skip to content

Commit

Permalink
Add job.run_if_scheduler() again
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Jun 6, 2023
1 parent 6a91e5e commit fd2d769
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions pyiron_base/jobs/job/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
run_job_with_status_suspended,
run_job_with_status_finished,
run_job_with_runmode_modal,
run_job_with_runmode_queue,
execute_job_with_external_executable,
)
from pyiron_base.jobs.job.util import (
Expand Down Expand Up @@ -722,6 +723,15 @@ def run_static(self):
"""
execute_job_with_external_executable(job=self)

def run_if_scheduler(self):
"""
The run if queue function is called by run if the user decides to submit the job to and queing system. The job
is submitted to the queuing system using subprocess.Popen()
Returns:
int: Returns the queue ID for the job.
"""
return run_job_with_runmode_queue(job=self)

def transfer_from_remote(self):
state.queue_adapter.get_job_from_remote(
working_directory="/".join(self.working_directory.split("/")[:-1]),
Expand Down
4 changes: 2 additions & 2 deletions pyiron_base/jobs/job/runfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def run_job_with_status_created(job):
):
run_job_with_runmode_non_modal(job=job)
elif job.server.run_mode.queue:
run_job_with_runmode_queue(job=job)
job.run_if_scheduler()
elif job.server.run_mode.interactive:
job.run_if_interactive()
elif job.server.run_mode.interactive_non_modal:
Expand Down Expand Up @@ -395,7 +395,7 @@ def run_job_with_runmode_srun(job):
+ job.job_id
)
else:
raise ValueError("run_if_srun() does not support local databases.")
raise ValueError("run_job_with_runmode_srun() does not support local databases.")
else:
command = (
"srun python -m pyiron_base.cli wrapper -p "
Expand Down

0 comments on commit fd2d769

Please sign in to comment.