elm.ords.services.base.Service
- class Service[source]
Bases:
ABC
Abstract base class for a Service that can be queued to run.
Methods
Use this method to allocate resources, if needed
call
(*args, **kwargs)Call the service.
process
(*args, **kwargs)Process a call to the service.
process_using_futures
(fut, *args, **kwargs)Process a call to the service.
Use this method to clean up resources, if needed
Attributes
Max number of concurrent job submissions.
Check if process function can be called.
Service name used to pull the correct queue object.
- MAX_CONCURRENT_JOBS = 10000
Max number of concurrent job submissions.
- async classmethod call(*args, **kwargs)[source]
Call the service.
- Parameters:
*args, **kwargs – Positional and keyword arguments to be passed to the underlying service processing function.
- Returns:
obj – A response object from the underlying service.
- async process_using_futures(fut, *args, **kwargs)[source]
Process a call to the service.
- Parameters:
fut (asyncio.Future) – A future object that should get the result of the processing operation. If the processing function returns
answer
, this method should callfut.set_result(answer)
.**kwargs – Keyword arguments to be passed to the underlying processing function.
- abstract property can_process
Check if process function can be called.
This should be a fast-running method that returns a boolean indicating wether or not the service can accept more processing calls.