xqute.schedulers.gbatch_scheduler
xqute.schedulers.gbatch_scheduler
GbatchScheduler
— Scheduler for Google Cloud Batch</>
xqute.schedulers.gbatch_scheduler.
GbatchScheduler
(
*args
, project
, location
, **kwargs
)
Scheduler for Google Cloud Batch
You can pass extra configuration parameters to the constructor
that will be used in the job configuration file.
For example, you can pass taskGroups
to specify the task groups
and their specifications.
For using containers, it is a little bit tricky to specify the commands.
When no entrypoint
is specified, the commands
should be a list
with the first element being the interpreter (e.g. /bin/bash
)
and the second element being the path to the wrapped job script.
If the entrypoint
is specified, we can use the {lang}
and {script}
placeholders in the commands
list, where {lang}
will be replaced
with the interpreter (e.g. /bin/bash
) and {script}
will be replaced
with the path to the wrapped job script.
With entrypoint
specified and no {script}
placeholder, the joined command
will be the interpreter followed by the path to the wrapped job script will be
appended to the commands
list.
**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
)
(SpecPath) — 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
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