bartender.picker#

Attributes#

Classes#

PickRound

Builder for round robin destination picker.

Functions#

pick_first(→ str)

Always picks first available destination from context.

pick_byname(→ str)

Picks destination with same name as application name.

pick_byindex(→ str)

Picks destination by index.

import_picker(→ DestinationPicker)

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:
Returns:

Destination name.

Return type:

str

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:
Returns:

Destination name.

Raises:

KeyError – If application has no destination.

Return type:

str

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:
Returns:

Destination name.

Return type:

str

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:
Returns:

Destination name.

Return type:

str

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