bartender.web.api.applications.views#
Attributes#
Functions#
|
Creates job model in the database, stage archive locally and submit to scheduler. |
|
Check whether submitter is allowed to use application. |
|
Validates the form request against the config.input_schema if it is defined. |
|
Validates the input payload against the provided configuration. |
|
Extracts the payload from the form request. |
Module Contents#
- bartender.web.api.applications.views.router#
- async bartender.web.api.applications.views.upload_job(application: str, request: fastapi.Request, job_dao: bartender.db.dao.job_dao.CurrentJobDAO, submitter: bartender.web.users.CurrentUser, context: bartender.context.CurrentContext, upload: fastapi.UploadFile = File(description='Archive with files needed for application')) fastapi.responses.RedirectResponse#
Creates job model in the database, stage archive locally and submit to scheduler.
- Parameters:
application (str) – Name of application to run job for.
upload (fastapi.UploadFile) – Archive with config file for application.
request (fastapi.Request) – request object.
job_dao (bartender.db.dao.job_dao.CurrentJobDAO) – JobDAO object.
submitter (bartender.web.users.CurrentUser) – User who submitted job.
context (bartender.context.CurrentContext) – Context with applications and destinations.
- Raises:
IndexError – When job could not created inside database or when config file was not found.
HTTPException – Application is invalid.
- Returns:
redirect response to created job.
- Return type:
fastapi.responses.RedirectResponse
- bartender.web.api.applications.views._check_role(application: str, submitter: bartender.web.users.User, context: bartender.context.Context) None#
Check whether submitter is allowed to use application.
When application has some allowed_roles defined then the submitter should have at least one of those roles to continue.
When application has no allowed_roles defined then the submitter is allowed to continue.
- Parameters:
application (str) – Name of application to run job for.
submitter (bartender.web.users.User) – User who submitted job.
context (bartender.context.Context) – Context with applications.
- Raises:
HTTPException – When submitter is missing role.
- Return type:
None
- async bartender.web.api.applications.views._validate_form(request: fastapi.Request, config: bartender.config.ApplicatonConfiguration) dict[str, str]#
Validates the form request against the config.input_schema if it is defined.
- Parameters:
request (fastapi.Request) – The request object.
config (bartender.config.ApplicatonConfiguration) – The configuration for the application.
- Returns:
The payload extracted from the form request. Without any files or duplicate keys.
- Return type:
- bartender.web.api.applications.views.validate_input(config: bartender.config.ApplicatonConfiguration, payload: dict[str, str]) None#
Validates the input payload against the provided configuration.
If invalid an exception is raised.
- Parameters:
config (ApplicatonConfiguration) – The application configuration.
payload (dict[str, str]) – The input payload to be validated.
- Return type:
None