iib.workers¶
Subpackages¶
Submodules¶
iib.workers.api_utils module¶
-
iib.workers.api_utils.get_request(request_id)¶ Get the IIB build request from the REST API.
Parameters: request_id (int) – the ID of the IIB request Returns: the request Return type: dict Raises: IIBError – if the HTTP request fails
-
iib.workers.api_utils.get_requests_session(auth=False)¶ Create a requests session with authentication (when enabled).
Parameters: auth (bool) – configure authentication on the session Returns: the configured requests session Return type: requests.Session
-
iib.workers.api_utils.set_request_state(request_id, state, state_reason)¶ Set the state of the request using the IIB API.
Parameters: - request_id (int) – the ID of the IIB request
- state (str) – the state to set the IIB request to
- state_reason (str) – the state reason to set the IIB request to
Returns: the updated request
Return type: dict
Raises: IIBError – if the request to the IIB API fails
-
iib.workers.api_utils.update_request(request_id, payload, exc_msg=None)¶ Update the IIB build request.
Parameters: - request_id (int) – the ID of the IIB request
- payload (dict) – the payload to send to the PATCH API endpoint
- exc_msg (str) – an optional custom exception that can be a template
Returns: the updated request
Return type: dict
Raises: IIBError – if the request to the IIB API fails
iib.workers.config module¶
-
class
iib.workers.config.Config¶ Bases:
objectThe base IIB Celery configuration.
-
class
iib.workers.config.DevelopmentConfig¶ Bases:
iib.workers.config.ConfigThe development IIB Celery configuration.
-
class
iib.workers.config.ProductionConfig¶ Bases:
iib.workers.config.ConfigThe production IIB Celery configuration.
-
class
iib.workers.config.TestingConfig¶ Bases:
iib.workers.config.DevelopmentConfigThe testing IIB Celery configuration.
-
iib.workers.config.configure_celery(celery_app)¶ Configure the Celery application instance.
Parameters: celery (celery.Celery) – the Celery application instance to configure
-
iib.workers.config.get_worker_config()¶ Return the Celery configuration.
-
iib.workers.config.validate_celery_config(conf, **kwargs)¶ Perform basic validatation on the Celery configuration when the worker is initialized.
Parameters: conf (celery.app.utils.Settings) – the Celery application configuration to validate Raises: iib.exceptions.ConfigError – if the configuration is invalid