11# Submitting jobs
22You can use the Python API to submit [ jobs] ( ../jobs/jobs.md ) (directed acyclic graphs of tasks)
3- through a [ ` Client ` ] ( hyperqueue.client.Client ) . In addition to the functionality offered by the
3+ through a [ ` Client ` ] ( pyapi: hyperqueue.client.Client) . In addition to the functionality offered by the
44HyperQueue CLI, you can use the Python API to add [ dependencies] ( dependencies.md ) between jobs,
55configure each task [ individually] ( #parametrizing-tasks ) and create tasks out of
66[ Python functions] ( #python-functions ) .
77
88## Job
9- To build a job, you first have to create an instance of the [ ` Job ` ] ( hyperqueue.job.Job ) class.
9+ To build a job, you first have to create an instance of the [ ` Job ` ] ( pyapi: hyperqueue.job.Job) class.
1010
1111``` python
1212from hyperqueue import Job
@@ -23,19 +23,19 @@ To create complex workflows, you can also specify [dependencies](dependencies.md
2323
2424### External programs
2525To create a task that will execute an external program, you can use the
26- [ ` program ` ] ( hyperqueue.job.Job#f_program ) method of a ` Job ` :
26+ [ ` program ` ] ( pyapi: hyperqueue.job.Job#f_program) method of a ` Job ` :
2727
2828``` python
2929job.program([" /bin/my-program" , " foo" , " bar" , " --arg" , " 42" ])
3030```
3131
3232You can pass the program arguments or various other [ parameters] ( #parametrizing-tasks ) to the task.
33- The ` program ` method will return a [ ` Task ` ] ( hyperqueue.task.task.Task ) object that represents the
33+ The ` program ` method will return a [ ` Task ` ] ( pyapi: hyperqueue.task.task.Task) object that represents the
3434created task. This object can be used further e.g. for defining [ dependencies] ( dependencies.md ) .
3535
3636### Python functions
3737If you want to execute a Python function as a task, you can use the
38- [ ` function ` ] ( hyperqueue.job.Job#f_function ) method of a ` Job ` :
38+ [ ` function ` ] ( pyapi: hyperqueue.job.Job#f_function) method of a ` Job ` :
3939
4040``` python
4141def preprocess_data (fast , path ):
@@ -57,7 +57,7 @@ Python tasks can be useful to perform e.g. various data preprocessing and organi
5757co-locate the logic of Python tasks together with the code that defines the submitted workflow (job),
5858without the need to write an additional external script.
5959
60- Same as with the ` program ` method, ` function ` will return a [ ` Task ` ] ( hyperqueue.task.task.Task )
60+ Same as with the ` program ` method, ` function ` will return a [ ` Task ` ] ( pyapi: hyperqueue.task.task.Task)
6161that can used to define [ dependencies] ( dependencies.md ) .
6262
6363!!! note
@@ -71,7 +71,7 @@ a worker - this means that it needs to have access to the correct Python version
7171that contains the ` hyperqueue ` package!
7272
7373To make sure that the function will be executed in the correct Python environment, you can use
74- [ ` PythonEnv ` ] ( hyperqueue.task.function.PythonEnv ) and its ` prologue ` argument. It lets you specify
74+ [ ` PythonEnv ` ] ( pyapi: hyperqueue.task.function.PythonEnv) and its ` prologue ` argument. It lets you specify
7575a (shell) command that will be executed before the Python interpreter that executes your
7676function is spawned.
7777
@@ -96,20 +96,20 @@ output paths, environment variables or HyperQueue specific parameters like
9696the CLI, where you can only use a single set of parameters for all tasks of a job, with the Python
9797API you can specify these parameters individually for each task.
9898
99- You can find more details in the documentation of the [ ` program ` ] ( hyperqueue.job.Job#f_program ) or
100- [ ` function ` ] ( hyperqueue.job.Job#f_function ) methods.
99+ You can find more details in the documentation of the [ ` program ` ] ( pyapi: hyperqueue.job.Job#f_program) or
100+ [ ` function ` ] ( pyapi: hyperqueue.job.Job#f_function) methods.
101101
102102## Submitting a job
103103Once you have added some tasks to the job, you can submit it using the ` Client ` 's
104- [ ` submit ` ] ( hyperqueue.client.Client#f_submit ) method:
104+ [ ` submit ` ] ( pyapi: hyperqueue.client.Client#f_submit) method:
105105
106106``` python
107107client = Client()
108108submitted = client.submit(job)
109109```
110110
111111To wait until the job has finished executing, use the
112- [ ` wait_for_jobs ` ] ( hyperqueue.client.Client#f_wait_for_jobs ) method:
112+ [ ` wait_for_jobs ` ] ( pyapi: hyperqueue.client.Client#f_wait_for_jobs) method:
113113
114114``` python
115115client.wait_for_jobs([submitted])
0 commit comments