Temporary
Temporary worker module.
TemporaryWorker
Temporary worker that automatically shuts down when queue is empty.
Source code in dvc_task/worker/temporary.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
__init__(app, timeout=60, **kwargs)
Construct a worker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
Celery
|
Celery application instance. |
required |
timeout
|
int
|
Queue timeout in seconds. Worker will be terminated if the queue remains empty after timeout. |
60
|
Additional keyword arguments will be passed as celery worker configuration.
Source code in dvc_task/worker/temporary.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
monitor(name)
Monitor the worker and stop it when the queue is empty.
Source code in dvc_task/worker/temporary.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
ping(name, timeout=1.0)
Ping the specified worker.
Source code in dvc_task/worker/temporary.py
41 42 43 |
|
start(name, fsapp_clean=False)
Start the worker if it does not already exist.
Runs the Celery worker main thread in the current process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Celery worker name. |
required |
fsapp_clean
|
bool
|
Automatically cleanup FSApp broker on shutdown. Has no effect unless app is an FSApp instance. |
False
|
Source code in dvc_task/worker/temporary.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|