girder-plugin-worker 5.0.0a5.dev113__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. girder_plugin_worker-5.0.0a5.dev113/MANIFEST.in +3 -0
  2. girder_plugin_worker-5.0.0a5.dev113/PKG-INFO +16 -0
  3. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/__init__.py +37 -0
  4. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/api/__init__.py +0 -0
  5. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/api/worker.py +37 -0
  6. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/celery.py +20 -0
  7. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/constants.py +31 -0
  8. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/event_handlers.py +144 -0
  9. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/status.py +67 -0
  10. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/utils.py +170 -0
  11. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/web_client/dist/girder-plugin-worker.umd.cjs +13 -0
  12. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker/web_client/dist/style.css +1 -0
  13. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker.egg-info/PKG-INFO +16 -0
  14. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker.egg-info/SOURCES.txt +19 -0
  15. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker.egg-info/dependency_links.txt +1 -0
  16. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker.egg-info/entry_points.txt +2 -0
  17. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker.egg-info/not-zip-safe +1 -0
  18. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker.egg-info/requires.txt +1 -0
  19. girder_plugin_worker-5.0.0a5.dev113/girder_plugin_worker.egg-info/top_level.txt +1 -0
  20. girder_plugin_worker-5.0.0a5.dev113/setup.cfg +4 -0
  21. girder_plugin_worker-5.0.0a5.dev113/setup.py +56 -0
@@ -0,0 +1,3 @@
1
+ prune girder_plugin_worker/web_client
2
+ include girder_plugin_worker/web_client/dist/girder-plugin-worker.umd.cjs
3
+ include girder_plugin_worker/web_client/dist/style.css
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.1
2
+ Name: girder-plugin-worker
3
+ Version: 5.0.0a5.dev113
4
+ Summary: The Girder server plugin interfacing with girder-worker
5
+ Home-page: http://girder.readthedocs.io/en/latest/plugins.html#worker
6
+ Author: Kitware, Inc.
7
+ Author-email: kitware@kitware.com
8
+ License: Apache 2.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Web Environment
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Requires-Python: >=3.8
16
+ Requires-Dist: girder>=3
@@ -0,0 +1,37 @@
1
+ import logging
2
+ from pathlib import Path
3
+
4
+ from girder import events
5
+ from girder.constants import AccessType
6
+ from girder.plugin import getPlugin, GirderPlugin, registerPluginStaticContent
7
+ from girder_jobs.models.job import Job
8
+
9
+ from .api.worker import Worker
10
+ from . import event_handlers
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ class WorkerPlugin(GirderPlugin):
16
+ DISPLAY_NAME = 'Worker'
17
+
18
+ def load(self, info):
19
+ getPlugin('jobs').load(info)
20
+
21
+ info['apiRoot'].worker = Worker()
22
+
23
+ registerPluginStaticContent(
24
+ plugin='worker',
25
+ js=['/girder-plugin-worker.umd.cjs'],
26
+ css=['/style.css'],
27
+ staticDir=Path(__file__).parent / 'web_client' / 'dist',
28
+ tree=info['serverRoot'],
29
+ )
30
+
31
+ events.bind('jobs.schedule', 'worker', event_handlers.schedule)
32
+ events.bind('jobs.status.validate', 'worker', event_handlers.validateJobStatus)
33
+ events.bind('jobs.status.validTransitions', 'worker', event_handlers.validTransitions)
34
+ events.bind('jobs.cancel', 'worker', event_handlers.cancel)
35
+ events.bind('model.job.save.after', 'worker', event_handlers.attachJobInfoSpec)
36
+ events.bind('model.job.save', 'worker', event_handlers.attachParentJob)
37
+ Job().exposeFields(AccessType.SITE_ADMIN, {'celeryTaskId', 'celeryQueue'})
@@ -0,0 +1,37 @@
1
+ import celery
2
+
3
+ from girder.api import access
4
+ from girder.api.describe import Description, autoDescribeRoute
5
+ from girder.constants import TokenScope
6
+ from girder.api.rest import Resource
7
+
8
+ from ..celery import getCeleryApp
9
+
10
+
11
+ class Worker(Resource):
12
+ def __init__(self):
13
+ super().__init__()
14
+ self.resourceName = 'worker'
15
+ self.route('GET', ('status',), self.getWorkerStatus)
16
+
17
+ @autoDescribeRoute(
18
+ Description('Get worker status and task information.')
19
+ .notes('Return -1 if the broker is inaccessible.')
20
+ )
21
+ @access.user(scope=TokenScope.DATA_READ)
22
+ def getWorkerStatus(self):
23
+ app = getCeleryApp()
24
+ result = {}
25
+ conn = app.connection_for_read()
26
+ try:
27
+ conn.ensure_connection(max_retries=1)
28
+ except celery.exceptions.OperationalError:
29
+ return -1
30
+
31
+ status = app.control.inspect()
32
+ result['report'] = status.report()
33
+ result['stats'] = status.stats()
34
+ result['ping'] = status.ping()
35
+ result['active'] = status.active() or {}
36
+ result['reserved'] = status.reserved() or {}
37
+ return result
@@ -0,0 +1,20 @@
1
+ import celery
2
+
3
+ from girder.models.setting import Setting
4
+
5
+ from .constants import PluginSettings
6
+
7
+ _celeryapp = None
8
+
9
+
10
+ def getCeleryApp():
11
+ """
12
+ Lazy loader for the celery app. Reloads anytime the settings are updated.
13
+ """
14
+ global _celeryapp
15
+
16
+ if _celeryapp is None:
17
+ backend = Setting().get(PluginSettings.BACKEND) or 'rpc://guest:guest@localhost/'
18
+ broker = Setting().get(PluginSettings.BROKER) or 'amqp://guest:guest@localhost/'
19
+ _celeryapp = celery.Celery('girder_worker', backend=backend, broker=broker)
20
+ return _celeryapp
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env python
2
+
3
+ ###############################################################################
4
+ # Copyright Kitware Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 ( the "License" );
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ ###############################################################################
18
+
19
+ # The path that will be mounted in docker containers for data IO
20
+ DOCKER_DATA_VOLUME = '/mnt/girder_worker/data'
21
+
22
+ # The path that will be mounted in docker containers for utility scripts
23
+ DOCKER_SCRIPTS_VOLUME = '/mnt/girder_worker/scripts'
24
+
25
+
26
+ # Settings where plugin information is stored
27
+ class PluginSettings:
28
+ BROKER = 'worker.broker'
29
+ BACKEND = 'worker.backend'
30
+ API_URL = 'worker.api_url'
31
+ DIRECT_PATH = 'worker.direct_path'
@@ -0,0 +1,144 @@
1
+ import logging
2
+
3
+ from girder.exceptions import ValidationException
4
+ from girder.utility import setting_utilities
5
+ from girder_jobs.constants import JobStatus
6
+ from girder_jobs.models.job import Job
7
+
8
+ from celery.result import AsyncResult
9
+
10
+ from .celery import getCeleryApp
11
+ from .constants import PluginSettings
12
+ from .status import CustomJobStatus
13
+ from .utils import getWorkerApiUrl, jobInfoSpec
14
+
15
+ logger = logging.getLogger(__name__)
16
+
17
+
18
+ @setting_utilities.validator({
19
+ PluginSettings.BROKER,
20
+ PluginSettings.BACKEND
21
+ })
22
+ def validateSettings(doc):
23
+ """
24
+ Handle plugin-specific system settings. Right now we don't do any
25
+ validation for the broker or backend URL settings, but we do reinitialize
26
+ the celery app object with the new values.
27
+ """
28
+ global _celeryapp
29
+ _celeryapp = None
30
+
31
+
32
+ @setting_utilities.validator({
33
+ PluginSettings.API_URL
34
+ })
35
+ def validateApiUrl(doc):
36
+ val = doc['value']
37
+ if val and not val.startswith('http://') and not val.startswith('https://'):
38
+ raise ValidationException('API URL must start with http:// or https://.', 'value')
39
+
40
+
41
+ @setting_utilities.validator(PluginSettings.DIRECT_PATH)
42
+ def _validateAutoCompute(doc):
43
+ if not isinstance(doc['value'], bool):
44
+ raise ValidationException('The direct path setting must be true or false.')
45
+
46
+
47
+ def validateJobStatus(event):
48
+ """Allow our custom job status values."""
49
+ if CustomJobStatus.isValid(event.info):
50
+ event.preventDefault().addResponse(True)
51
+
52
+
53
+ def validTransitions(event):
54
+ """Allow our custom job transitions."""
55
+ states = None
56
+ if event.info['job']['handler'] == 'worker_handler':
57
+ states = CustomJobStatus.validTransitionsWorker(event.info['status'])
58
+ elif event.info['job']['handler'] == 'celery_handler':
59
+ states = CustomJobStatus.validTransitionsCelery(event.info['status'])
60
+ if states is not None:
61
+ event.preventDefault().addResponse(states)
62
+
63
+
64
+ def schedule(event):
65
+ """
66
+ This is bound to the "jobs.schedule" event, and will be triggered any time
67
+ a job is scheduled. This handler will process any job that has the
68
+ handler field set to "worker_handler".
69
+ """
70
+ job = event.info
71
+ if job['handler'] == 'worker_handler':
72
+ task = job.get('celeryTaskName', 'girder_worker.run')
73
+
74
+ # Set the job status to queued
75
+ Job().updateJob(job, status=JobStatus.QUEUED)
76
+
77
+ # Send the task to celery
78
+ asyncResult = getCeleryApp().send_task(
79
+ task, job['args'], job['kwargs'], queue=job.get('celeryQueue'), headers={
80
+ 'jobInfoSpec': jobInfoSpec(job, job.get('token', None)),
81
+ 'apiUrl': getWorkerApiUrl()
82
+ })
83
+
84
+ # Record the task ID from celery.
85
+ Job().updateJob(job, otherFields={
86
+ 'celeryTaskId': asyncResult.task_id
87
+ })
88
+
89
+ # Stop event propagation since we have taken care of scheduling.
90
+ event.stopPropagation()
91
+
92
+
93
+ def cancel(event):
94
+ """
95
+ This is bound to the "jobs.cancel" event, and will be triggered any time
96
+ a job is canceled. This handler will process any job that has the
97
+ handler field set to "worker_handler".
98
+ """
99
+ job = event.info
100
+ if job['handler'] in ['worker_handler', 'celery_handler']:
101
+ # Stop event propagation and prevent default, we are using a custom state
102
+ event.stopPropagation().preventDefault()
103
+
104
+ celeryTaskId = job.get('celeryTaskId')
105
+
106
+ if celeryTaskId is None:
107
+ msg = ("Unable to cancel Celery task. Job '%s' doesn't have a Celery task id."
108
+ % job['_id'])
109
+ logger.warn(msg)
110
+ return
111
+
112
+ should_revoke = False
113
+ if job['status'] == JobStatus.INACTIVE:
114
+ # Move inactive jobs directly to canceled state
115
+ Job().updateJob(job, status=JobStatus.CANCELED)
116
+ should_revoke = True
117
+
118
+ elif job['status'] not in [CustomJobStatus.CANCELING, JobStatus.CANCELED,
119
+ JobStatus.SUCCESS, JobStatus.ERROR]:
120
+ # Give active jobs a chance to be canceled by their runner
121
+ Job().updateJob(job, status=CustomJobStatus.CANCELING)
122
+ should_revoke = True
123
+
124
+ if should_revoke:
125
+ # Send the revoke request.
126
+ asyncResult = AsyncResult(celeryTaskId, app=getCeleryApp())
127
+ asyncResult.revoke()
128
+
129
+
130
+ def attachParentJob(event):
131
+ """Attach parentJob before a model is saved."""
132
+ job = event.info
133
+ if job.get('celeryParentTaskId'):
134
+ celeryParentTaskId = job['celeryParentTaskId']
135
+ parentJob = Job().findOne({'celeryTaskId': celeryParentTaskId})
136
+ event.info['parentId'] = parentJob['_id']
137
+
138
+
139
+ def attachJobInfoSpec(event):
140
+ """Attach jobInfoSpec after a model is saved."""
141
+ job = event.info
142
+ # Local jobs have a module key
143
+ if not job.get('module'):
144
+ Job().updateJob(job, otherFields={'jobInfoSpec': jobInfoSpec(job)})
@@ -0,0 +1,67 @@
1
+ from girder_jobs.constants import JobStatus
2
+
3
+
4
+ class CustomJobStatus:
5
+ """The custom job status flags for the worker."""
6
+
7
+ FETCHING_INPUT = 820
8
+ CONVERTING_INPUT = 821
9
+ CONVERTING_OUTPUT = 822
10
+ PUSHING_OUTPUT = 823
11
+ CANCELING = 824
12
+
13
+ # valid transitions for worker scheduled jobs
14
+ valid_worker_transitions = {
15
+ JobStatus.QUEUED: [JobStatus.INACTIVE],
16
+ JobStatus.RUNNING: [JobStatus.QUEUED, FETCHING_INPUT],
17
+ FETCHING_INPUT: [JobStatus.RUNNING],
18
+ CONVERTING_INPUT: [JobStatus.RUNNING, FETCHING_INPUT],
19
+ CONVERTING_OUTPUT: [JobStatus.RUNNING],
20
+ PUSHING_OUTPUT: [JobStatus.RUNNING, CONVERTING_OUTPUT],
21
+ CANCELING: [JobStatus.INACTIVE, JobStatus.QUEUED, JobStatus.RUNNING],
22
+ JobStatus.ERROR: [FETCHING_INPUT, CONVERTING_INPUT, CONVERTING_OUTPUT,
23
+ PUSHING_OUTPUT, CANCELING, JobStatus.QUEUED,
24
+ JobStatus.RUNNING],
25
+ # The last two are allowed for revoke called from outside Girder
26
+ JobStatus.CANCELED: [CANCELING, JobStatus.QUEUED, JobStatus.RUNNING],
27
+ JobStatus.SUCCESS: [JobStatus.RUNNING, PUSHING_OUTPUT]
28
+ }
29
+
30
+ # valid transitions for celery scheduled jobs
31
+ # N.B. We have the extra worker input/output states defined here for when
32
+ # we are running girder_worker.run as a regular celery task
33
+ valid_celery_transitions = {
34
+ JobStatus.QUEUED: [JobStatus.INACTIVE],
35
+ # Note celery tasks can jump straight from INACTIVE to RUNNING
36
+ JobStatus.RUNNING: [JobStatus.INACTIVE, JobStatus.QUEUED,
37
+ FETCHING_INPUT],
38
+ FETCHING_INPUT: [JobStatus.RUNNING],
39
+ CONVERTING_INPUT: [JobStatus.RUNNING, FETCHING_INPUT],
40
+ CONVERTING_OUTPUT: [JobStatus.RUNNING],
41
+ PUSHING_OUTPUT: [JobStatus.RUNNING, CONVERTING_OUTPUT],
42
+ CANCELING: [JobStatus.INACTIVE, JobStatus.QUEUED, JobStatus.RUNNING],
43
+ JobStatus.ERROR: [FETCHING_INPUT, CONVERTING_INPUT, CONVERTING_OUTPUT,
44
+ PUSHING_OUTPUT, CANCELING, JobStatus.QUEUED,
45
+ JobStatus.RUNNING],
46
+ JobStatus.CANCELED: [CANCELING, JobStatus.INACTIVE, JobStatus.QUEUED,
47
+ JobStatus.RUNNING],
48
+ JobStatus.SUCCESS: [JobStatus.RUNNING, PUSHING_OUTPUT]
49
+ }
50
+
51
+ @classmethod
52
+ def isValid(cls, status):
53
+ return status in (
54
+ cls.FETCHING_INPUT,
55
+ cls.CONVERTING_INPUT,
56
+ cls.CONVERTING_OUTPUT,
57
+ cls.PUSHING_OUTPUT,
58
+ cls.CANCELING
59
+ )
60
+
61
+ @classmethod
62
+ def validTransitionsWorker(cls, status):
63
+ return cls.valid_worker_transitions.get(status)
64
+
65
+ @classmethod
66
+ def validTransitionsCelery(cls, status):
67
+ return cls.valid_celery_transitions.get(status)
@@ -0,0 +1,170 @@
1
+ #!/usr/bin/env python
2
+
3
+ ###############################################################################
4
+ # Copyright Kitware Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 ( the "License" );
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ ###############################################################################
18
+
19
+ from .constants import PluginSettings
20
+ from girder.api.rest import getApiUrl
21
+ from girder.exceptions import FilePathException
22
+ from girder.models.file import File
23
+ from girder.models.setting import Setting
24
+ from girder.utility import setting_utilities
25
+ from girder_jobs.models.job import Job
26
+
27
+
28
+ @setting_utilities.validator({
29
+ PluginSettings.BROKER,
30
+ PluginSettings.BACKEND
31
+ })
32
+ def validateSettings(doc):
33
+ """
34
+ Handle plugin-specific system settings. Right now we don't do any
35
+ validation for the broker or backend URL settings, but we do reinitialize
36
+ the celery app object with the new values.
37
+ """
38
+ global _celeryapp
39
+ _celeryapp = None
40
+
41
+
42
+ def getWorkerApiUrl():
43
+ """
44
+ Return the API base URL to which the worker should callback to
45
+ write output information back to the server. This is controlled
46
+ via a system setting, and the default is to use the core server
47
+ root setting.
48
+ """
49
+ apiUrl = Setting().get(PluginSettings.API_URL)
50
+ return apiUrl or getApiUrl()
51
+
52
+
53
+ def girderInputSpec(resource, resourceType='file', name=None, token=None,
54
+ dataType='string', dataFormat='text', fetchParent=False):
55
+ """
56
+ Downstream plugins that are building Girder worker jobs that use Girder IO
57
+ should use this to generate the input specs more easily.
58
+
59
+ :param resource: The resource document to be downloaded at runtime.
60
+ :type resource: dict
61
+ :param resourceType: The resource type to download for the input. Should
62
+ be "folder", "item", or "file".
63
+ :type resourceType: str
64
+ :param name: The name of the resource to download. If not passed, uses
65
+ the "name" field of the resource document.
66
+ :type name: str or None
67
+ :param token: The Girder token document or raw token string to use to
68
+ authenticate when downloading. Pass `None` for anonymous downloads.
69
+ :type token: dict, str, or None
70
+ :param dataType: The worker `type` field.
71
+ :type dataType: str
72
+ :param dataFormat: The worker `format` field.
73
+ :type dataFormat: str
74
+ :param fetchParent: Whether to fetch the whole parent resource of the
75
+ specified resource as a side effect.
76
+ :type fetchParent: bool
77
+ """
78
+ if isinstance(token, dict):
79
+ token = token['_id']
80
+
81
+ result = {
82
+ 'mode': 'girder',
83
+ 'api_url': getWorkerApiUrl(),
84
+ 'token': token,
85
+ 'id': str(resource['_id']),
86
+ 'name': name or resource['name'],
87
+ 'resource_type': resourceType,
88
+ 'type': dataType,
89
+ 'format': dataFormat,
90
+ 'fetch_parent': fetchParent
91
+ }
92
+
93
+ if resourceType == 'file' and not fetchParent and Setting().get(PluginSettings.DIRECT_PATH):
94
+ # If we are adding a file and it exists on the local filesystem include
95
+ # that location. This can permit the user of the specification to
96
+ # access the file directly instead of downloading the file.
97
+ try:
98
+ result['direct_path'] = File().getLocalFilePath(resource)
99
+ except FilePathException:
100
+ pass
101
+ return result
102
+
103
+
104
+ def girderOutputSpec(parent, token, parentType='folder', name=None,
105
+ dataType='string', dataFormat='text', reference=None):
106
+ """
107
+ Downstream plugins that are building worker jobs that use Girder IO
108
+ should use this to generate the output specs more easily.
109
+
110
+ :param parent: The parent to upload the data into (an item or folder).
111
+ :type parent: dict
112
+ :param token: The Girder token document or raw token string to use to
113
+ authenticate when uploading.
114
+ :type token: dict or str
115
+ :param parentType: The type of the parent object ("item" or "folder").
116
+ :type parentType: str
117
+ :param name: Name of the resource to use when uploading. Required if
118
+ the output target type is "memory". If the target is "filepath", uses
119
+ the basename of the file being uploaded by default.
120
+ :type name: str or None
121
+ :param dataType: The worker `type` field.
122
+ :type dataType: str
123
+ :param dataFormat: The worker `format` field.
124
+ :type dataFormat: str
125
+ :param reference: Optional "reference" string to pass back to the server
126
+ during the upload. This can be used to attach arbitrary data to this
127
+ for tracking purposes, e.g., referring back to related inputs. Bind to
128
+ the "data.process" event to hook into the upload and inspect references.
129
+ :type reference: str
130
+ """
131
+ if isinstance(token, dict):
132
+ token = token['_id']
133
+
134
+ return {
135
+ 'mode': 'girder',
136
+ 'api_url': getWorkerApiUrl(),
137
+ 'token': token,
138
+ 'name': name,
139
+ 'parent_id': str(parent['_id']),
140
+ 'parent_type': parentType,
141
+ 'type': dataType,
142
+ 'format': dataFormat,
143
+ 'reference': reference
144
+ }
145
+
146
+
147
+ def jobInfoSpec(job, token=None, logPrint=True):
148
+ """
149
+ Build the jobInfo specification for a task to write status and log output
150
+ back to a Girder job.
151
+
152
+ :param job: The job document representing the worker task.
153
+ :type job: dict
154
+ :param token: The token to use. Creates a job token if not passed.
155
+ :type token: str or dict
156
+ :param logPrint: Whether standard output from the job should be
157
+ """
158
+ if token is None:
159
+ token = Job().createJobToken(job)
160
+
161
+ if isinstance(token, dict):
162
+ token = token['_id']
163
+
164
+ return {
165
+ 'method': 'PUT',
166
+ 'url': '/'.join((getWorkerApiUrl(), 'job', str(job['_id']))),
167
+ 'reference': str(job['_id']),
168
+ 'headers': {'Girder-Token': token},
169
+ 'logPrint': logPrint
170
+ }
@@ -0,0 +1,13 @@
1
+ (function(_){typeof define=="function"&&define.amd?define(_):_()})(function(){"use strict";function _(t,u,F,e){if(!(t instanceof Error))throw t;if(!(typeof window>"u"&&u||e))throw t.message+=" on line "+F,t;var r,c,g,a;try{e=e||require("fs").readFileSync(u,{encoding:"utf8"}),r=3,c=e.split(`
2
+ `),g=Math.max(F-r,0),a=Math.min(c.length,F+r)}catch(n){return t.message+=" - could not read from "+u+" ("+n.message+")",void _(t,null,F)}r=c.slice(g,a).map(function(n,k){var o=k+g+1;return(o==F?" > ":" ")+o+"| "+n}).join(`
3
+ `),t.path=u;try{t.message=(u||"Pug")+":"+F+`
4
+ `+r+`
5
+
6
+ `+t.message}catch{}throw t}function E(t){var u="",F,e;try{e=1,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<div class="g-config-breadcrumb-container"></div>',e=3,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"<p>",e=4,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"Configure how Girder should connect to the celery worker.",e=5,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+`
7
+ `,e=5,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"</p>",e=6,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<form id="g-worker-settings-form" role="form">',e=7,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<div class="form-group">',e=8,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<label class="control-label" for="g-worker-broker">',e=8,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"Celery broker URL</label>",e=9,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<input class="input-sm form-control" id="g-worker-broker" type="text" placeholder="Broker (default: amqp://guest:guest@localhost/)"/></div>',e=11,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<div class="form-group">',e=12,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<label class="control-label" for="g-worker-backend">',e=12,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"Celery backend URL</label>",e=13,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<input class="input-sm form-control" id="g-worker-backend" type="text" placeholder="Backend (default: rpc://guest:guest@localhost/)"/></div>',e=15,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<div class="form-group">',e=16,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<label class="control-label" for="g-worker-api-url">',e=16,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"Alternative Girder API URL</label>",e=17,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<input class="input-sm form-control" id="g-worker-api-url" type="text" placeholder="API URL (default: auto-detected)"/></div>',e=19,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<div class="checkbox">',e=20,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<label class="control-label" for="g-worker-direct-path">',e=21,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<input id="g-worker-direct-path" type="checkbox"/>',e=22,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"<span>",e=22,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"When possible, send local file paths to the worker to avoid downloading files</span></label></div>",e=24,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<p class="g-validation-failed-message" id="g-worker-settings-error-message"></p>',e=25,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<input class="btn btn-sm btn-primary" type="submit" value="Save"/></form>',e=27,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+'<button class="q-worker-task-info btn btn-default" title="Task information" style="margin-top:10px;">',e=28,F="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/configView.pug",u=u+"Task information</button>"}catch(r){_(r,F,e)}return u}const V=girder.views.widgets.PluginConfigBreadcrumbWidget,j=girder.views.View,S=girder.events,{restRequest:m}=girder.rest,f=girder.router;var v=j.extend({events:{"submit #g-worker-settings-form":function(t){t.preventDefault(),this.$("#g-worker-settings-error-message").empty(),this._saveSettings([{key:"worker.api_url",value:this.$("#g-worker-api-url").val().trim()},{key:"worker.broker",value:this.$("#g-worker-broker").val().trim()},{key:"worker.backend",value:this.$("#g-worker-backend").val().trim()},{key:"worker.direct_path",value:this.$("#g-worker-direct-path").is(":checked")}])},"click .q-worker-task-info":function(t){f.navigate("#plugins/worker/task/status",{trigger:!0})}},initialize:function(){m({method:"GET",url:"system/setting",data:{list:JSON.stringify(["worker.api_url","worker.broker","worker.backend","worker.direct_path"])}}).done(t=>{this.render(),this.$("#g-worker-api-url").val(t["worker.api_url"]),this.$("#g-worker-broker").val(t["worker.broker"]),this.$("#g-worker-backend").val(t["worker.backend"]),this.$("#g-worker-direct-path").prop("checked",t["worker.direct_path"])})},render:function(){return this.$el.html(E()),this.breadcrumb||(this.breadcrumb=new V({pluginName:"Worker",el:this.$(".g-config-breadcrumb-container"),parentView:this})),this.breadcrumb.render(),this},_saveSettings:function(t){m({method:"PUT",url:"system/setting",data:{list:JSON.stringify(t)},error:null}).done(u=>{S.trigger("g:alert",{icon:"ok",text:"Settings saved.",type:"success",timeout:4e3})}).fail(u=>{this.$("#g-worker-settings-error-message").text(u.responseJSON.message)})}});function i(t){var u=""+t,F=y.exec(u);if(!F)return t;var e,r,c,g="";for(e=F.index,r=0;e<u.length;e++){switch(u.charCodeAt(e)){case 34:c="&quot;";break;case 38:c="&amp;";break;case 60:c="&lt;";break;case 62:c="&gt;";break;default:continue}r!==e&&(g+=u.substring(r,e)),r=e+1,g+=c}return r!==e?g+u.substring(r,e):g}var y=/["&<>]/;function h(t,u,F,e){if(!(t instanceof Error))throw t;if(!(typeof window>"u"&&u||e))throw t.message+=" on line "+F,t;var r,c,g,a;try{e=e||require("fs").readFileSync(u,{encoding:"utf8"}),r=3,c=e.split(`
8
+ `),g=Math.max(F-r,0),a=Math.min(c.length,F+r)}catch(n){return t.message+=" - could not read from "+u+" ("+n.message+")",void h(t,null,F)}r=c.slice(g,a).map(function(n,k){var o=k+g+1;return(o==F?" > ":" ")+o+"| "+n}).join(`
9
+ `),t.path=u;try{t.message=(u||"Pug")+":"+F+`
10
+ `+r+`
11
+
12
+ `+t.message}catch{}throw t}function T(t){var u="",F,e,r;try{var c=t||{};(function(g,a,n,k,o,O){r=1,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<h1 class="g-worker-status-header">',r=2,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"Global information about workers",r=3,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",n?(r=4,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<i class="icon-spin4 icon-spin"></i>'):(r=6,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<button class="g-worker-status-btn-reload">',r=7,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<i class="icon-arrows-cw"></i></button>'),u=u+"</h1>",r=9,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",n||(r=10,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<div class="g-worker-status-content">',r=11,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",a!==null?(r=12,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<p class="g-worker-status-no-worker-message">',r=13,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=a)==null?"":F)+"</p>"):(r=15,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<table class="g-worker-status-table">',r=16,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<tr>",r=17,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=17,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Name")==null?"":F)+"</th>",r=18,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=18,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Status")==null?"":F)+"</th>",r=19,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=19,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Max Concurrency")==null?"":F)+"</th>",r=20,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=20,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Accepted tasks")==null?"":F)+"</th>",r=21,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=21,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Running tasks")==null?"":F)+"</th>",r=22,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=22,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Completed tasks")==null?"":F)+"</th>",r=23,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=23,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Report")==null?"":F)+"</th></tr>",r=24,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",(function(){var s=o;if(typeof s.length=="number")for(var p=0,w=s.length;p<w;p++){var l=s[p];r=25,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<tr class="g-worker-task-status-link">',r=26,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=27,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.name)==null?"":F)+"</td>",r=28,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",l.ping==="pong"?(r=29,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=29,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Online")==null?"":F)+"</td>"):(r=31,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=31,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Offline")==null?"":F)+"</td>"),r=32,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=33,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.concurrency)==null?"":F)+"</td>",r=34,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=35,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.stats)==null?"":F)+"</td>",r=36,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=37,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.active.length)==null?"":F)+"</td>",r=38,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=39,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.stats-l.active.length)==null?"":F)+"</td>",r=40,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=41,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.report)==null?"":F)+"</td></tr>"}else{var w=0;for(var p in s){w++;var l=s[p];r=25,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<tr class="g-worker-task-status-link">',r=26,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=27,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.name)==null?"":F)+"</td>",r=28,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",l.ping==="pong"?(r=29,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=29,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Online")==null?"":F)+"</td>"):(r=31,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=31,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Offline")==null?"":F)+"</td>"),r=32,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=33,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.concurrency)==null?"":F)+"</td>",r=34,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=35,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.stats)==null?"":F)+"</td>",r=36,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=37,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.active.length)==null?"":F)+"</td>",r=38,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=39,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.stats-l.active.length)==null?"":F)+"</td>",r=40,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=41,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.report)==null?"":F)+"</td></tr>"}}}).call(this),u=u+"</table>",r=43,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",(g.length||k.length)&&(r=44,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<div class="g-worker-task-status">',r=45,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<h2 class="g-worker-status-header">',r=46,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=O)==null?"":F)+"</h2>",r=47,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",g.length&&(r=48,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<h3 class="g-worker-status-header">',r=49,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"Running Tasks</h3>",r=50,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<table class="g-worker-task-status-table">',r=51,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<tr>",r=52,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=52,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Name")==null?"":F)+"</th>",r=53,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=53,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="ID")==null?"":F)+"</th>",r=54,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=54,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Type")==null?"":F)+"</th>",r=55,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=55,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Time Start")==null?"":F)+"</th>",r=56,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=56,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Arguments")==null?"":F)+"</th>",r=57,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=57,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="KeyWord Arguments")==null?"":F)+"</th>",r=58,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=58,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Worker PID")==null?"":F)+"</th></tr>",r=59,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",(function(){var s=g;if(typeof s.length=="number")for(var p=0,w=s.length;p<w;p++){var l=s[p];r=60,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<tr>",r=61,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=62,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.name)==null?"":F)+"</td>",r=63,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=64,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.id)==null?"":F)+"</td>",r=65,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=66,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.type)==null?"":F)+"</td>",r=67,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=68,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.time_start)==null?"":F)+"</td>",r=69,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=70,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.args)==null?"":F)+"</td>",r=71,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=72,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.kwargs)==null?"":F)+"</td>",r=73,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=74,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.worker_pid)==null?"":F)+"</td></tr>"}else{var w=0;for(var p in s){w++;var l=s[p];r=60,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<tr>",r=61,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=62,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.name)==null?"":F)+"</td>",r=63,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=64,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.id)==null?"":F)+"</td>",r=65,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=66,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.type)==null?"":F)+"</td>",r=67,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=68,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.time_start)==null?"":F)+"</td>",r=69,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=70,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.args)==null?"":F)+"</td>",r=71,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=72,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.kwargs)==null?"":F)+"</td>",r=73,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=74,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.worker_pid)==null?"":F)+"</td></tr>"}}}).call(this),u=u+"</table>"),r=75,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",k.length&&(r=76,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<h3 class="g-worker-status-header">',r=77,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"Queued Tasks</h3>",r=78,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+'<table class="g-worker-task-status-table">',r=79,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<tr>",r=80,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=80,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Name")==null?"":F)+"</th>",r=81,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=81,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="ID")==null?"":F)+"</th>",r=82,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=82,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Type")==null?"":F)+"</th>",r=83,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=83,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Arguments")==null?"":F)+"</th>",r=84,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=84,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="KeyWord Arguments")==null?"":F)+"</th>",r=85,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=85,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Priority")==null?"":F)+"</th>",r=86,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<th>",r=86,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F="Redelivered")==null?"":F)+"</th></tr>",r=87,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",(function(){var s=k;if(typeof s.length=="number")for(var p=0,w=s.length;p<w;p++){var l=s[p];r=88,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<tr>",r=89,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=90,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.name)==null?"":F)+"</td>",r=91,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=92,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.id)==null?"":F)+"</td>",r=93,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=94,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.type)==null?"":F)+"</td>",r=95,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=96,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.args)==null?"":F)+"</td>",r=97,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=98,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.kwargs)==null?"":F)+"</td>",r=99,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=100,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.delivery_info.priority)==null?"":F)+"</td>",r=101,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=102,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.delivery_info.redelivered)==null?"":F)+"</td></tr>"}else{var w=0;for(var p in s){w++;var l=s[p];r=88,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<tr>",r=89,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=90,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.name)==null?"":F)+"</td>",r=91,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=92,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.id)==null?"":F)+"</td>",r=93,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=94,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.type)==null?"":F)+"</td>",r=95,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=96,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.args)==null?"":F)+"</td>",r=97,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=98,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.kwargs)==null?"":F)+"</td>",r=99,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=100,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.delivery_info.priority)==null?"":F)+"</td>",r=101,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+"<td>",r=102,e="/home/circleci/project/girder/plugins/worker/girder_plugin_worker/web_client/templates/taskStatusView.pug",u=u+i((F=l.delivery_info.redelivered)==null?"":F)+"</td></tr>"}}}).call(this),u=u+"</table>"),u=u+"</div>")),u=u+"</div>")}).call(this,"activeTasks"in c?c.activeTasks:typeof activeTasks<"u"?activeTasks:void 0,"errorMsg"in c?c.errorMsg:typeof errorMsg<"u"?errorMsg:void 0,"load"in c?c.load:typeof load<"u"?load:void 0,"reservedTasks"in c?c.reservedTasks:typeof reservedTasks<"u"?reservedTasks:void 0,"workerList"in c?c.workerList:typeof workerList<"u"?workerList:void 0,"workerName"in c?c.workerName:typeof workerName<"u"?workerName:void 0)}catch(g){h(g,e,r)}return u}const d=girder._,$=girder.views.View,{restRequest:N}=girder.rest;var R=$.extend({events:{"click .g-worker-status-btn-reload":function(){this._fetchWorkerStatus()},"click .g-worker-task-status-link":function(t){var u=t.target.parentElement,F=u.childNodes[0].innerText;d.each(this.workers,e=>{e.name===F&&(this.workerName=F,this.activeTaskList=e.active,this.reservedTaskList=e.reserved,this.render())})}},initialize:function(){this.errorMsg=null,this._fetchWorkerStatus()},render:function(){return this.$el.html(T({workerList:this.workers,load:this.load,workerName:this.workerName,activeTasks:this.activeTaskList,reservedTasks:this.reservedTaskList,errorMsg:this.errorMsg})),this},_fetchWorkerStatus:function(){this.workers=[],this.activeTaskList=[],this.reservedTaskList=[],this.load=!0,N({method:"GET",url:"worker/status"}).done(t=>{t===-1?this.errorMsg="The Broker is inaccessible.":(this.errorMsg=null,this.parseWorkerStatus(t.report,t.stats,t.ping,t.active,t.reserved)),this.load=!1,this.render()}),this.render()},parseWorkerStatus:function(t,u,F,e,r){var c=d.keys(t),g=null,a=null,n=null,k=null;d.each(c,o=>{d.has(t[o],"ok")&&(g=t[o].ok),u[o].total!==null&&(a=d.values(u[o].total)[0]),u[o].pool!==null&&(n=u[o].pool["max-concurrency"]),d.has(F[o],"ok")&&(k=F[o].ok),this.workers.push({name:o,report:g,stats:a|0,concurrency:n|0,ping:k,active:e[o]||[],reserved:r[o]})}),this.workers.length||(this.errorMsg="No task information.")}});const b=girder.router,C=girder.events,{exposePluginConfig:x}=girder.utilities.PluginUtils;x("worker","plugins/worker/config"),b.route("plugins/worker/config","workerConfig",function(){C.trigger("g:navigateTo",v)}),b.route("plugins/worker/task/status","workerTaskStatus",function(){C.trigger("g:navigateTo",R)}),girder.events.on("g:appload.before",()=>{const t=girder.plugins.jobs.JobStatus;t.registerStatus({WORKER_FETCHING_INPUT:{value:820,text:"Fetching input",icon:"icon-download",color:"#89d2e2"},WORKER_CONVERTING_INPUT:{value:821,text:"Converting input",icon:"icon-shuffle",color:"#92f5b5"},WORKER_CONVERTING_OUTPUT:{value:822,text:"Converting output",icon:"icon-shuffle",color:"#92f5b5"},WORKER_PUSHING_OUTPUT:{value:823,text:"Pushing output",icon:"icon-upload",color:"#89d2e2"},WORKER_CANCELING:{value:824,text:"Canceling",icon:"icon-spin3 animate-spin",color:"#f89406"}});const u=t.isCancelable;t.isCancelable=function(F){const e=F.get("handler");return e==="worker_handler"||e==="celery_handler"?[t.CANCELED,t.WORKER_CANCELING,t.SUCCESS,t.ERROR].indexOf(F.get("status"))===-1:u(F)}})});
13
+ //# sourceMappingURL=girder-plugin-worker.umd.cjs.map
@@ -0,0 +1 @@
1
+ .g-job-color-fetching-input,.g-job-color-pushing-output{background-color:#89d2e2;color:#333}.g-job-color-converting-input,.g-job-color-converting-output{background-color:#92f5b5;color:#fff}.g-worker-status-header{margin:20px;font-size:30px}.g-worker-task-status{margin-top:30px;padding:0 0 30px 30px;border:1px solid #ddd}.g-worker-task-status-link{cursor:pointer}.g-worker-status-table tr:nth-child(2n){background-color:#c1e4be80}.g-worker-status-table tr:hover{background-color:#ddd9}.g-worker-task-status-table tr:nth-child(2n){background-color:#c1e4be80}.g-worker-status-table th,.g-worker-task-status-table th{padding:10px;text-align:left;border:1px solid #ddd;background-color:#a2c491;color:#fff}.g-worker-status-table td,.g-worker-task-status-table td{padding:10px;border:1px solid #ddd}.icon-spin{display:inline-block;animation:spin 2s infinite linear;margin-left:30px}.g-worker-status-btn-reload{background-color:#fff;margin-left:30px;padding:5px;font-size:20px;color:#909090;border:solid 1px #909090;border-radius:20%;vertical-align:bottom}.g-worker-status-btn-reload:hover{transition-duration:.5s;background-color:#b0b0b0;color:#fff}.g-worker-status-btn-reload:active{transition-duration:.1s;background-color:#a2c491;border-color:#a2c491;color:#fff}@-moz-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@-o-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.1
2
+ Name: girder-plugin-worker
3
+ Version: 5.0.0a5.dev113
4
+ Summary: The Girder server plugin interfacing with girder-worker
5
+ Home-page: http://girder.readthedocs.io/en/latest/plugins.html#worker
6
+ Author: Kitware, Inc.
7
+ Author-email: kitware@kitware.com
8
+ License: Apache 2.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Web Environment
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Requires-Python: >=3.8
16
+ Requires-Dist: girder>=3
@@ -0,0 +1,19 @@
1
+ MANIFEST.in
2
+ setup.py
3
+ girder_plugin_worker/__init__.py
4
+ girder_plugin_worker/celery.py
5
+ girder_plugin_worker/constants.py
6
+ girder_plugin_worker/event_handlers.py
7
+ girder_plugin_worker/status.py
8
+ girder_plugin_worker/utils.py
9
+ girder_plugin_worker.egg-info/PKG-INFO
10
+ girder_plugin_worker.egg-info/SOURCES.txt
11
+ girder_plugin_worker.egg-info/dependency_links.txt
12
+ girder_plugin_worker.egg-info/entry_points.txt
13
+ girder_plugin_worker.egg-info/not-zip-safe
14
+ girder_plugin_worker.egg-info/requires.txt
15
+ girder_plugin_worker.egg-info/top_level.txt
16
+ girder_plugin_worker/api/__init__.py
17
+ girder_plugin_worker/api/worker.py
18
+ girder_plugin_worker/web_client/dist/girder-plugin-worker.umd.cjs
19
+ girder_plugin_worker/web_client/dist/style.css
@@ -0,0 +1,2 @@
1
+ [girder.plugin]
2
+ worker = girder_plugin_worker:WorkerPlugin
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,56 @@
1
+ import os
2
+ import re
3
+
4
+ from setuptools import find_packages, setup
5
+
6
+
7
+ def prerelease_local_scheme(version):
8
+ """Return local scheme version unless building on master in CircleCI.
9
+ This function returns the local scheme version number
10
+ (e.g. 0.0.0.dev<N>+g<HASH>) unless building on CircleCI for a
11
+ pre-release in which case it ignores the hash and produces a
12
+ PEP440 compliant pre-release version number (e.g. 0.0.0.dev<N>).
13
+ """
14
+ from setuptools_scm.version import get_local_node_and_date
15
+
16
+ # this regex allows us to publish pypi packages from master, our LTS maintenance branches, and
17
+ # our next major version integration branches
18
+ pattern = r'master|[0-9]+\.x-maintenance|v[0-9]+-integration'
19
+
20
+ if re.match(pattern, os.getenv('CIRCLE_BRANCH', '')):
21
+ return ''
22
+ else:
23
+ return get_local_node_and_date(version)
24
+
25
+
26
+ setup(
27
+ name='girder-plugin-worker',
28
+ use_scm_version={'root': '../..', 'local_scheme': prerelease_local_scheme},
29
+ setup_requires=[
30
+ 'setuptools-scm',
31
+ 'setuptools-git',
32
+ ],
33
+ description='The Girder server plugin interfacing with girder-worker',
34
+ author='Kitware, Inc.',
35
+ author_email='kitware@kitware.com',
36
+ url='http://girder.readthedocs.io/en/latest/plugins.html#worker',
37
+ license='Apache 2.0',
38
+ classifiers=[
39
+ 'Development Status :: 4 - Beta',
40
+ 'Environment :: Web Environment',
41
+ 'License :: OSI Approved :: Apache Software License',
42
+ 'Operating System :: OS Independent',
43
+ 'Programming Language :: Python',
44
+ 'Programming Language :: Python :: 3',
45
+ ],
46
+ include_package_data=True,
47
+ python_requires='>=3.8',
48
+ packages=find_packages(exclude=['plugin_tests']),
49
+ zip_safe=False,
50
+ install_requires=['girder>=3'],
51
+ entry_points={
52
+ 'girder.plugin': [
53
+ 'worker = girder_plugin_worker:WorkerPlugin'
54
+ ]
55
+ }
56
+ )