pipen.scheduler
Provide builting schedulers
SchedulerPostInit
— Provides post init function for all schedulers</>LocalScheduler
— Local scheduler</>SgeScheduler
— SGE scheduler</>SlurmScheduler
— Slurm scheduler</>SshScheduler
— SSH scheduler</>GbatchScheduler
— Google Cloud Batch scheduler</>
get_scheduler
(
scheduler
)
(Type) — Get the scheduler by name of the scheduler class itself</>
pipen.scheduler.
SchedulerPostInit
(
)
Provides post init function for all schedulers
pipen.scheduler.
LocalScheduler
(
workdir
, forks=1
, error_strategy='ignore'
, num_retries=3
, prescript=''
, postscript=''
, jobname_prefix=None
, **kwargs
)
Local scheduler
workdir
(str | PathType) — The working directoryforks
(int, optional) — Max number of job forkserror_strategy
(str, optional) — The strategy when there is error happenednum_retries
(int, optional) — Max number of retries when error_strategy is retryprescript
(str, optional) — The prescript to run before the job commandIt is a piece of script that inserted into the wrapper script, running on the scheduler system.postscript
(str, optional) — The postscript to run when job finishedIt is a piece of script that inserted into the wrapper script, running on the scheduler system.jobname_prefix
(str | none, optional) — The prefix for the job name**kwargs
— Other arguments for the scheduler
job_class
— The job classjobcmd_wrapper_init
— The init script for the job command wrapperjobcmd_wrapper_init
(str) — The init script for the job command wrapper</>name
— The name of the scheduler
create_job
(
index
,cmd
)
(Job) — Create a job</>job_is_running
(
job
)
(bool) — Tell if a job is really running, not only the job.jid_file</>job_is_submitted_or_running
(
job
)
(bool) — Check if a job is already submitted or running</>jobcmd_end
(
job
)
(str) — The job command end</>jobcmd_init
(
job
)
(str) — The job command init</>jobcmd_prep
(
job
)
(str) — The job command preparation</>jobcmd_shebang
(
job
)
(str) — The shebang of the wrapper script</>kill_job
(
job
)
— Kill a job asynchronously</>kill_job_and_update_status
(
job
)
— Kill a job and update its status</>kill_running_jobs
(
jobs
)
— Try to kill all running jobs</>polling_jobs
(
jobs
,on
)
(bool) — Check if all jobs are done or new jobs can submit</>retry_job
(
job
)
— Retry a job</>submit_job
(
job
)
(int) — Submit a job locally</>submit_job_and_update_status
(
job
)
— Submit and update the status</>wrap_job_script
(
job
)
(str) — Wrap the job script</>wrapped_job_script
(
job
)
(DualPath) — Get the wrapped job script</>
create_job
(
index
, cmd
)
Create a job
index
(int) — The index of the jobcmd
(Union) — The command of the job
The job
submit_job_and_update_status
(
job
)
Submit and update the status
- Check if the job is already submitted or running
- If not, run the hook
- If the hook is not cancelled, clean the job
- Submit the job, raising an exception if it fails
- If the job is submitted successfully, update the status
- If the job fails to submit, update the status and write stderr to the job file
job
(Job) — The job
retry_job
(
job
)
Retry a job
job
(Job) — The job
kill_job_and_update_status
(
job
)
Kill a job and update its status
job
(Job) — The job
polling_jobs
(
jobs
, on
)
Check if all jobs are done or new jobs can submit
jobs
(List) — The list of jobson
(str) — query on status:submittable
orall_done
True if yes otherwise False.
kill_running_jobs
(
jobs
)
Try to kill all running jobs
jobs
(List) — The list of jobs
job_is_submitted_or_running
(
job
)
Check if a job is already submitted or running
job
(Job) — The job
True if yes otherwise False.
jobcmd_shebang
(
job
)
→ str
The shebang of the wrapper script
jobcmd_init
(
job
)
→ str
The job command init
jobcmd_prep
(
job
)
→ str
The job command preparation
jobcmd_end
(
job
)
→ str
The job command end
wrap_job_script
(
job
)
Wrap the job script
job
(Job) — The job
The wrapped script
wrapped_job_script
(
job
)
Get the wrapped job script
job
(Job) — The job
The path of the wrapped job script
submit_job
(
job
)
Submit a job locally
job
(Job) — The job
The process id
kill_job
(
job
)
Kill a job asynchronously
job
(Job) — The job
job_is_running
(
job
)
Tell if a job is really running, not only the job.jid_file
In case where the jid file is not cleaned when job is done.
job
(Job) — The job
True if it is, otherwise False
pipen.scheduler.
SgeScheduler
(
*args
, **kwargs
)
SGE scheduler
**kwargs
— Other arguments for the scheduler
job_class
— The job classjobcmd_wrapper_init
— The init script for the job command wrapperjobcmd_wrapper_init
(str) — The init script for the job command wrapper</>name
— The name of the scheduler
create_job
(
index
,cmd
)
(Job) — Create a job</>job_is_running
(
job
)
(bool) — Tell if a job is really running, not only the job.jid_file</>job_is_submitted_or_running
(
job
)
(bool) — Check if a job is already submitted or running</>jobcmd_end
(
job
)
(str) — The job command end</>jobcmd_init
(
job
)
(str) — The job command init</>jobcmd_prep
(
job
)
(str) — The job command preparation</>jobcmd_shebang
(
job
)
(str) — The shebang of the wrapper script</>kill_job
(
job
)
— Kill a job on SGE</>kill_job_and_update_status
(
job
)
— Kill a job and update its status</>kill_running_jobs
(
jobs
)
— Try to kill all running jobs</>polling_jobs
(
jobs
,on
)
(bool) — Check if all jobs are done or new jobs can submit</>retry_job
(
job
)
— Retry a job</>submit_job
(
job
)
(str) — Submit a job to SGE</>submit_job_and_update_status
(
job
)
— Submit and update the status</>wrap_job_script
(
job
)
(str) — Wrap the job script</>wrapped_job_script
(
job
)
(DualPath) — Get the wrapped job script</>
create_job
(
index
, cmd
)
Create a job
index
(int) — The index of the jobcmd
(Union) — The command of the job
The job
submit_job_and_update_status
(
job
)
Submit and update the status
- Check if the job is already submitted or running
- If not, run the hook
- If the hook is not cancelled, clean the job
- Submit the job, raising an exception if it fails
- If the job is submitted successfully, update the status
- If the job fails to submit, update the status and write stderr to the job file
job
(Job) — The job
retry_job
(
job
)
Retry a job
job
(Job) — The job
kill_job_and_update_status
(
job
)
Kill a job and update its status
job
(Job) — The job
polling_jobs
(
jobs
, on
)
Check if all jobs are done or new jobs can submit
jobs
(List) — The list of jobson
(str) — query on status:submittable
orall_done
True if yes otherwise False.
kill_running_jobs
(
jobs
)
Try to kill all running jobs
jobs
(List) — The list of jobs
job_is_submitted_or_running
(
job
)
Check if a job is already submitted or running
job
(Job) — The job
True if yes otherwise False.
jobcmd_init
(
job
)
→ str
The job command init
jobcmd_prep
(
job
)
→ str
The job command preparation
jobcmd_end
(
job
)
→ str
The job command end
wrap_job_script
(
job
)
Wrap the job script
job
(Job) — The job
The wrapped script
wrapped_job_script
(
job
)
Get the wrapped job script
job
(Job) — The job
The path of the wrapped job script
jobcmd_shebang
(
job
)
→ str
The shebang of the wrapper script
submit_job
(
job
)
Submit a job to SGE
job
(Job) — The job
The job id
kill_job
(
job
)
Kill a job on SGE
job
(Job) — The job
job_is_running
(
job
)
Tell if a job is really running, not only the job.jid_file
In case where the jid file is not cleaned when job is done.
job
(Job) — The job
True if it is, otherwise False
pipen.scheduler.
SlurmScheduler
(
*args
, **kwargs
)
Slurm scheduler
**kwargs
— Other arguments for the scheduler
job_class
— The job classjobcmd_wrapper_init
— The init script for the job command wrapperjobcmd_wrapper_init
(str) — The init script for the job command wrapper</>name
— The name of the scheduler
create_job
(
index
,cmd
)
(Job) — Create a job</>job_is_running
(
job
)
(bool) — Tell if a job is really running, not only the job.jid_file</>job_is_submitted_or_running
(
job
)
(bool) — Check if a job is already submitted or running</>jobcmd_end
(
job
)
(str) — The job command end</>jobcmd_init
(
job
)
(str) — The job command init</>jobcmd_prep
(
job
)
(str) — The job command preparation</>jobcmd_shebang
(
job
)
(str) — The shebang of the wrapper script</>kill_job
(
job
)
— Kill a job on Slurm</>kill_job_and_update_status
(
job
)
— Kill a job and update its status</>kill_running_jobs
(
jobs
)
— Try to kill all running jobs</>polling_jobs
(
jobs
,on
)
(bool) — Check if all jobs are done or new jobs can submit</>retry_job
(
job
)
— Retry a job</>submit_job
(
job
)
(str) — Submit a job to Slurm</>submit_job_and_update_status
(
job
)
— Submit and update the status</>wrap_job_script
(
job
)
(str) — Wrap the job script</>wrapped_job_script
(
job
)
(DualPath) — Get the wrapped job script</>
create_job
(
index
, cmd
)
Create a job
index
(int) — The index of the jobcmd
(Union) — The command of the job
The job
submit_job_and_update_status
(
job
)
Submit and update the status
- Check if the job is already submitted or running
- If not, run the hook
- If the hook is not cancelled, clean the job
- Submit the job, raising an exception if it fails
- If the job is submitted successfully, update the status
- If the job fails to submit, update the status and write stderr to the job file
job
(Job) — The job
retry_job
(
job
)
Retry a job
job
(Job) — The job
kill_job_and_update_status
(
job
)
Kill a job and update its status
job
(Job) — The job
polling_jobs
(
jobs
, on
)
Check if all jobs are done or new jobs can submit
jobs
(List) — The list of jobson
(str) — query on status:submittable
orall_done
True if yes otherwise False.
kill_running_jobs
(
jobs
)
Try to kill all running jobs
jobs
(List) — The list of jobs
job_is_submitted_or_running
(
job
)
Check if a job is already submitted or running
job
(Job) — The job
True if yes otherwise False.
jobcmd_init
(
job
)
→ str
The job command init
jobcmd_prep
(
job
)
→ str
The job command preparation
jobcmd_end
(
job
)
→ str
The job command end
wrap_job_script
(
job
)
Wrap the job script
job
(Job) — The job
The wrapped script
wrapped_job_script
(
job
)
Get the wrapped job script
job
(Job) — The job
The path of the wrapped job script
jobcmd_shebang
(
job
)
→ str
The shebang of the wrapper script
submit_job
(
job
)
Submit a job to Slurm
job
(Job) — The job
The job id
kill_job
(
job
)
Kill a job on Slurm
job
(Job) — The job
job_is_running
(
job
)
Tell if a job is really running, not only the job.jid_file
In case where the jid file is not cleaned when job is done.
job
(Job) — The job
True if it is, otherwise False
pipen.scheduler.
SshScheduler
(
*args
, **kwargs
)
SSH scheduler
**kwargs
— Other arguments for the scheduler
job_class
— The job classjobcmd_wrapper_init
— The init script for the job command wrapperjobcmd_wrapper_init
(str) — The init script for the job command wrapper</>name
— The name of the scheduler
create_job
(
index
,cmd
)
(Job) — Create a job</>job_is_running
(
job
)
(bool) — Tell if a job is really running, not only the job.jid_file</>job_is_submitted_or_running
(
job
)
(bool) — Check if a job is already submitted or running</>jobcmd_end
(
job
)
(str) — The job command end</>jobcmd_init
(
job
)
(str) — The job command init</>jobcmd_prep
(
job
)
(str) — The job command preparation</>jobcmd_shebang
(
job
)
(str) — The shebang of the wrapper script</>kill_job
(
job
)
— Kill a job on SSH</>kill_job_and_update_status
(
job
)
— Kill a job and update its status</>kill_running_jobs
(
jobs
)
— Try to kill all running jobs</>polling_jobs
(
jobs
,on
)
(bool) — Check if all jobs are done or new jobs can submit</>retry_job
(
job
)
— Retry a job</>submit_job
(
job
)
(str) — Submit a job to SSH</>submit_job_and_update_status
(
job
)
— Submit and update the status</>wrap_job_script
(
job
)
(str) — Wrap the job script</>wrapped_job_script
(
job
)
(DualPath) — Get the wrapped job script</>
create_job
(
index
, cmd
)
Create a job
index
(int) — The index of the jobcmd
(Union) — The command of the job
The job
submit_job_and_update_status
(
job
)
Submit and update the status
- Check if the job is already submitted or running
- If not, run the hook
- If the hook is not cancelled, clean the job
- Submit the job, raising an exception if it fails
- If the job is submitted successfully, update the status
- If the job fails to submit, update the status and write stderr to the job file
job
(Job) — The job
retry_job
(
job
)
Retry a job
job
(Job) — The job
kill_job_and_update_status
(
job
)
Kill a job and update its status
job
(Job) — The job
polling_jobs
(
jobs
, on
)
Check if all jobs are done or new jobs can submit
jobs
(List) — The list of jobson
(str) — query on status:submittable
orall_done
True if yes otherwise False.
kill_running_jobs
(
jobs
)
Try to kill all running jobs
jobs
(List) — The list of jobs
job_is_submitted_or_running
(
job
)
Check if a job is already submitted or running
job
(Job) — The job
True if yes otherwise False.
jobcmd_shebang
(
job
)
→ str
The shebang of the wrapper script
jobcmd_init
(
job
)
→ str
The job command init
jobcmd_prep
(
job
)
→ str
The job command preparation
jobcmd_end
(
job
)
→ str
The job command end
wrap_job_script
(
job
)
Wrap the job script
job
(Job) — The job
The wrapped script
wrapped_job_script
(
job
)
Get the wrapped job script
job
(Job) — The job
The path of the wrapped job script
submit_job
(
job
)
Submit a job to SSH
job
(Job) — The job
The job id
kill_job
(
job
)
Kill a job on SSH
job
(Job) — The job
job_is_running
(
job
)
Tell if a job is really running, not only the job.jid_file
In case where the jid file is not cleaned when job is done.
job
(Job) — The job
True if it is, otherwise False
pipen.scheduler.
GbatchScheduler
(
*args
, project
, location
, fast_mount=None
, **kwargs
)
Google Cloud Batch scheduler
**kwargs
— Other arguments for the scheduler
jobcmd_wrapper_init
— The init script for the job command wrappername
— The name of the scheduler
create_job
(
index
,cmd
)
(Job) — Create a job</>job_is_running
(
job
)
(bool) — Check if a job is really running</>job_is_submitted_or_running
(
job
)
(bool) — Check if a job is already submitted or running</>jobcmd_end
(
job
)
(str) — The job command end</>jobcmd_init
(
job
)
(str) — The job command init</>jobcmd_prep
(
job
)
(str) — The job command preparation</>jobcmd_shebang
(
job
)
(str) — The shebang of the wrapper script</>kill_job
(
job
)
— Kill a job</>kill_job_and_update_status
(
job
)
— Kill a job and update its status</>kill_running_jobs
(
jobs
)
— Try to kill all running jobs</>polling_jobs
(
jobs
,on
)
(bool) — Check if all jobs are done or new jobs can submit</>retry_job
(
job
)
— Retry a job</>submit_job
(
job
)
(str) — Submit a job</>submit_job_and_update_status
(
job
)
— Submit and update the status</>wrap_job_script
(
job
)
(str) — Wrap the job script</>wrapped_job_script
(
job
)
(DualPath) — Get the wrapped job script</>
create_job
(
index
, cmd
)
Create a job
index
(int) — The index of the jobcmd
(Union) — The command of the job
The job
submit_job_and_update_status
(
job
)
Submit and update the status
- Check if the job is already submitted or running
- If not, run the hook
- If the hook is not cancelled, clean the job
- Submit the job, raising an exception if it fails
- If the job is submitted successfully, update the status
- If the job fails to submit, update the status and write stderr to the job file
job
(Job) — The job
retry_job
(
job
)
Retry a job
job
(Job) — The job
kill_job_and_update_status
(
job
)
Kill a job and update its status
job
(Job) — The job
polling_jobs
(
jobs
, on
)
Check if all jobs are done or new jobs can submit
jobs
(List) — The list of jobson
(str) — query on status:submittable
orall_done
True if yes otherwise False.
kill_running_jobs
(
jobs
)
Try to kill all running jobs
jobs
(List) — The list of jobs
job_is_submitted_or_running
(
job
)
Check if a job is already submitted or running
job
(Job) — The job
True if yes otherwise False.
jobcmd_shebang
(
job
)
→ str
The shebang of the wrapper script
jobcmd_init
(
job
)
→ str
The job command init
jobcmd_prep
(
job
)
→ str
The job command preparation
jobcmd_end
(
job
)
→ str
The job command end
wrap_job_script
(
job
)
Wrap the job script
job
(Job) — The job
The wrapped script
wrapped_job_script
(
job
)
Get the wrapped job script
job
(Job) — The job
The path of the wrapped job script
submit_job
(
job
)
Submit a job
job
(Job) — The job
The unique id in the scheduler system
kill_job
(
job
)
Kill a job
job
(Job) — The job
job_is_running
(
job
)
Check if a job is really running
job
(Job) — The job
True if yes otherwise False.
pipen.scheduler.
get_scheduler
(
scheduler
)
Get the scheduler by name of the scheduler class itself
scheduler
(Union) — The scheduler class or name
The scheduler class