bartender.config#
Parses config file as list of applications, schedulers and filesystems.
Attributes#
Classes#
Configuration for an application. |
|
Configuration for an interactive application. |
|
Bartender configuration. |
Functions#
|
Build a config instance from a yaml formatted file. |
|
|
|
Get config based on current request. |
Module Contents#
- class bartender.config.ApplicatonConfiguration#
Bases:
pydantic.BaseModelConfiguration for an application.
- command_template#
Shell command template to run in job directory. Use Jinja2 template syntax to substitute variables from request body.
- input_schema#
JSON schema of request body. Dialect of JSON Schema should be draft 2020-12. Root should be an object.
- summary#
The summary of the application, if any.
- description#
The description of the application, if any.
- upload_needs#
A list of file names that should exist in the uploaded archive file during submission. If empty then no files are required to be present in the archive.
- allowed_roles#
A list of roles that are allowed to submit jobs. If empty then anyone can submit jobs.
- bartender.config.ApplicatonConfigurations#
- class bartender.config.InteractiveApplicationConfiguration#
Bases:
pydantic.BaseModelConfiguration for an interactive application.
Example
Given completed job 1 run interactive app rescore with:
response = client.post('/api/job/1/interactiveapp/rescore', json={ 'capri_dir': 'output/06_caprieval', 'w_elec': 0.2, 'w_vdw': 0.2, 'w_desolv': 0.2, 'w_bsa': 0.1, 'w_air': 0.3, }) if response.json()['returncode'] == 0: # Find the results in the job directory somewhere path = '/api/job/1/files/output/06_caprieval_interactive/capri_clt.tsv' files = client.get(path)
- command_template#
Shell command template to run in job directory. Use Jinja2 template syntax to substitute variables from request body.
- input_schema#
JSON schema of request body. Dialect of JSON Schema should be draft 2020-12. Root should be an object.
- summary#
Summary of the interactive app.
- description#
Description of the interactive app.
- timeout#
Maximum time in seconds to wait for command to finish.
- job_application#
Name of the application that generated the job. If not set, the interactive app can be run on any job. If set, the interactive app can only be run on jobs that were submitted for that given application.
- timeout: confloat(gt=0, le=60) = 30.0#
- bartender.config.InteractiveApplicationConfigurations#
- class bartender.config.Config#
Bases:
pydantic.BaseModelBartender configuration.
The bartender.settings.Settings class is for FastAPI settings. The bartender.config.Config class is for non-FastAPI configuration.
If config is empty will create a single slot in memory scheduler with a local file system.
- applications: ApplicatonConfigurations#
- destinations: dict[str, bartender.destinations.DestinationConfig]#
- job_root_dir: pydantic.types.DirectoryPath#
- interactive_applications: InteractiveApplicationConfigurations#
- validate_job_root_dir(v: pydantic.types.DirectoryPath) pydantic.types.DirectoryPath#
Resolves the job root directory path to an absolute path.
- Parameters:
v (pydantic.types.DirectoryPath) – The directory path to validate.
- Returns:
The resolved directory path.
- Return type:
pydantic.types.DirectoryPath
- applications_non_empty(v: ApplicatonConfigurations) ApplicatonConfigurations#
Validates that applications dict is filled.
- Parameters:
v (ApplicatonConfigurations) – The given dict.
- Raises:
ValueError – When dict is empty.
- Returns:
The given dict.
- Return type:
ApplicatonConfigurations
- check_job_application(values: dict[str, Any]) dict[str, Any]#
Check that all interactive applications have a valid job_application.
- Parameters:
values (dict[str, Any]) – The configuration values to check.
- Returns:
The original configuration values.
- Raises:
AssertionError – If an interactive application has an invalid job_application.
- Return type:
- bartender.config.build_config(config_filename: pathlib.Path) Config#
Build a config instance from a yaml formatted file.
- Parameters:
config_filename (pathlib.Path) – File name of configuration file.
- Returns:
A config instance.
- Return type:
- bartender.config._load(config_filename: pathlib.Path) Any#
- Parameters:
config_filename (pathlib.Path) –
- Return type:
Any
- bartender.config.get_config(request: fastapi.Request) Config#
Get config based on current request.
- Parameters:
request (fastapi.Request) – The current FastAPI request.
- Returns:
The config.
- Return type:
- bartender.config.CurrentConfig#