daemon.tasks module
class daemon.tasks.DaemonWorker(id, files, name, \args, **kwargs*)[source]
Bases: threading.Thread
Worker Thread for JinaD
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.
args is the argument tuple for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
arguments
The decorator to cache property of a class.
metadata
The decorator to cache property of a class.
workdir
The decorator to cache property of a class.
daemon_file
The decorator to cache property of a class.
network_id
The decorator to cache property of a class.
generate_image()[source]
build and create a docker image
Return type
str
Returns
image id
container_id
The decorator to cache property of a class.
run()[source]
Method representing the worker thread’s activity DaemonWorker is a daemon thread responsible for the following tasks: During create: - store uploaded files in a local workspace - create a docker network for the workspace which would be used by all child containers - build a docker image to be used by all child containers - create a container if run command is passed During update: - update files in the local workspace - removes the workspace container, if any - recreate workspace container, if run command is passed
Return type
None
class daemon.tasks.ConsumerThread(\args, **kwargs*)[source]
Bases: threading.Thread
Consumer Thread for JinaD
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.
args is the argument tuple for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
run()[source]
Method representing the ConsumerThread’s activity ConsumerThread is a daemon thread that waits for messages from the __task_queue__ and starts a DaemonWorker for each message.
Return type
None