def post(self, plugin, workflow): plugin, workflow = get_plugin_workflow(plugin, workflow) input_artifacts = {} input_params = {} output_names = {} for argument in self.request.arguments: value = self.get_argument(argument) if argument.startswith('in-'): name = argument[3:] input_artifacts[name] = uuid.UUID(value) elif argument.startswith('param-'): name = argument[6:] input_params[name] = value elif argument.startswith('out-'): name = argument[4:] if not value: raise TypeError( "Must enter an output name for the artifact.") output_names[name] = value context_manager = Q2D3Context(os.getcwd(), output_names=output_names) input_artifact_fps = { name: context_manager.data[uuid] for name, uuid in input_artifacts.items() } output_artifact_fps = {} for name, value in output_names.items(): output_artifact_fps[name] = os.path.join( context_manager._data_dir, value + '.qzf') job = workflow.to_markdown(input_artifact_fps, input_params, output_artifact_fps) path = str(job.uuid) + '.md' with open(path, mode='w') as fh: fh.write(job.code) self.redirect('http://localhost:%d/notebooks/%s' % (port, path))
def post(self, plugin, workflow): plugin, workflow = get_plugin_workflow(plugin, workflow) input_artifacts = {} input_params = {} output_names = {} for argument in self.request.arguments: value = self.get_argument(argument) if argument.startswith('in-'): name = argument[3:] input_artifacts[name] = uuid.UUID(value) elif argument.startswith('param-'): name = argument[6:] input_params[name] = value elif argument.startswith('out-'): name = argument[4:] if not value: raise TypeError( "Must enter an output name for the artifact.") output_names[name] = value context_manager = Q2D3Context(os.getcwd(), output_names=output_names) input_artifact_fps = {name: context_manager.data[uuid] for name, uuid in input_artifacts.items()} output_artifact_fps = {} for name, value in output_names.items(): output_artifact_fps[name] = os.path.join( context_manager._data_dir, value + '.qzf') job = workflow.to_markdown(input_artifact_fps, input_params, output_artifact_fps) path = str(job.uuid) + '.md' with open(path, mode='w') as fh: fh.write(job.code) self.redirect('http://localhost:%d/notebooks/%s' % (port, path))
def get(self, plugin, workflow): plugin, workflow = get_plugin_workflow(plugin, workflow) self.render("static/job.html", plugin=plugin, workflow=workflow)