def submit_workflow(workflow): """ Submit the requested workflow to the postprocessing server. """ check_submit_allowed() data = json.loads(request.data) server = data.get('server') if not server: raise ValidationError(server="required") user_config = data.get('config', {}) from tasks import upload_workflow upload_workflow(workflow.id, app.config['base_path'], 'http://{0}/api/workflow/upload'.format(server), user_config, start_process=data.get('start_process', False), start_output=data.get('start_output', False)) return 'OK'
def submit_workflow(workflow): """ Enqueue workflow for submission to a postprocessing server. It is possible to submit a configuration object that should be used on the remote end for the workflow. Optionally, it can be specified if postprocessing and output generation should immediately be enqueued on the remote server. Once the submission was succesfully enqueued, watch for the :py:data:`spreadsplug.web.tasks.on_submit_started` which is emitted when the submission actually started and subsequently :py:data:`spreadsplug.web.tasks.on_submit_progressed`, :py:data:`spreadsplug.web.tasks.on_submit_completed` and :py:data:`spreadsplug.web.tasks.on_submit_error`. :reqheader Accept: :mimetype:`application/json` :param workflow: UUID or slug for the workflow to be submitted :type workflow: str :<json string server: Address of server to submit to :<json object config: Configuration to use for workflow on remote server. :<json boolean start_process: Whether to enqueue workflow for post-processing on the remote server. :<json boolean start_output: Whether to enqueue workflow for output generation on the remote server. :status 200: When the transfer was successfully enqueued. :status 400: When no postprocessing server was specified :status 500: When the `python-dbus` package was not found. :status 503: When no removable USB device could be found for mounting. """ data = json.loads(request.data) server = data.get('server') if not server: raise ValidationError(server="required") user_config = data.get('config', {}) from tasks import upload_workflow upload_workflow(workflow.id, app.config['base_path'], 'http://{0}/api/workflow/upload'.format(server), user_config, start_process=data.get('start_process', False), start_output=data.get('start_output', False)) return 'OK'
def submit_workflow(workflow): """ Submit the requested workflow to the postprocessing server. Only available in 'scanner' mode. Requires that the 'postproc_server' option is set to the address of a server with the server in 'processor' or 'full' mode running. """ if app.config['mode'] != 'scanner': raise ApiException("Submission only possible when running in 'scanner'" " mode.", 503) data = json.loads(request.data) server = data.get('server') if not server: raise ApiException("Missing 'server' field in JSON data", 400) user_config = data.get('config', {}) from tasks import upload_workflow # TODO: Pass config to this function upload_workflow(workflow.id, app.config['base_path'], 'http://{0}/api/workflow'.format(server), user_config, start_process=data.get('start_process', False), start_output=data.get('start_output', False)) return 'OK'