bartender.picker#
Attributes#
Classes#
Builder for round robin destination picker. |
Functions#
|
Always picks first available destination from context. |
|
Picks destination with same name as application name. |
|
Picks destination by index. |
|
Import a picker function. |
Module Contents#
- bartender.picker.DestinationPicker#
- bartender.picker.pick_first(job_dir: pathlib.Path, application_name: str, submitter: bartender.user.User, context: bartender.context.Context) str#
Always picks first available destination from context.
- Parameters:
job_dir (pathlib.Path) – Location where job input files are located.
application_name (str) – Application name that should be run.
submitter (bartender.user.User) – User that submitted the job.
context (bartender.context.Context) – Context with applications and destinations.
- Returns:
Destination name.
- Return type:
- bartender.picker.pick_byname(job_dir: pathlib.Path, application_name: str, submitter: bartender.user.User, context: bartender.context.Context) str#
Picks destination with same name as application name.
- Parameters:
job_dir (pathlib.Path) – Location where job input files are located.
application_name (str) – Application name that should be run.
submitter (bartender.user.User) – User that submitted the job.
context (bartender.context.Context) – Context with applications and destinations.
- Returns:
Destination name.
- Raises:
KeyError – If application has no destination.
- Return type:
- bartender.picker.pick_byindex(job_dir: pathlib.Path, application_name: str, submitter: bartender.user.User, context: bartender.context.Context) str#
Picks destination by index.
For example the 2nd application will be submitted to the 2nd destination.
- Parameters:
job_dir (pathlib.Path) – Location where job input files are located.
application_name (str) – Application name that should be run.
submitter (bartender.user.User) – User that submitted the job.
context (bartender.context.Context) – Context with applications and destinations.
- Returns:
Destination name.
- Return type:
- class bartender.picker.PickRound#
Builder for round robin destination picker.
- last = ''#
- __call__(job_dir: pathlib.Path, application_name: str, submitter: bartender.user.User, context: bartender.context.Context) str#
Always picks the next destination.
Takes list of destinations and each time it is called will pick the next destination in the destination list. Going around to start when end is reached.
- Parameters:
job_dir (pathlib.Path) – Location where job input files are located.
application_name (str) – Application name that should be run.
submitter (bartender.user.User) – User that submitted the job.
context (bartender.context.Context) – Context with applications and destinations.
- Returns:
Destination name.
- Return type:
- bartender.picker.pick_round: DestinationPicker#
- bartender.picker.import_picker(destination_picker_name: str) DestinationPicker#
Import a picker function.
- Parameters:
destination_picker_name (str) – function import as string. Format <module>:<function> or <path to python file>:<function>
- Returns:
Function that can be used to pick to which destination a job should be submitted.
- Raises:
ValueError – If the function could not be imported.
- Return type:
DestinationPicker