Commit 53456423 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

split get_workflows_status into 2 functions to clearify calls

parent f1cfbe78
......@@ -350,31 +350,33 @@ class JFlowServer (object):
@cherrypy.expose
@jsonify
def get_workflows_status(self, **kwargs):
if kwargs.has_key("workflow_id"):
workflow = self.wfmanager.get_workflow(kwargs["workflow_id"])
if kwargs["display"] == "list":
return self.jsonify_workflow_status(workflow)
elif kwargs["display"] == "graph":
g = workflow.get_execution_graph()
status = self.jsonify_workflow_status(workflow)
status["nodes"] = g.nodes()
status["edges"] = g.edges()
return status
else:
status = []
workflows = self.wfmanager.get_workflows()
for workflow in workflows:
if kwargs.has_key("metadata_filter"):
is_ok = False
for wf_meta in workflow.metadata:
for metadata in kwargs["metadata_filter"].split(","):
if wf_meta == metadata:
is_ok = True
break
if is_ok: break
if is_ok: status.append(self.jsonify_workflow_status(workflow))
else:
status.append(self.jsonify_workflow_status(workflow))
status = []
workflows = self.wfmanager.get_workflows()
for workflow in workflows:
if kwargs.has_key("metadata_filter"):
is_ok = False
for wf_meta in workflow.metadata:
for metadata in kwargs["metadata_filter"].split(","):
if wf_meta == metadata:
is_ok = True
break
if is_ok: break
if is_ok: status.append(self.jsonify_workflow_status(workflow))
else:
status.append(self.jsonify_workflow_status(workflow))
return status
@cherrypy.expose
@jsonify
def get_workflow_status(self, **kwargs):
workflow = self.wfmanager.get_workflow(kwargs["workflow_id"])
if kwargs["display"] == "list":
return self.jsonify_workflow_status(workflow)
elif kwargs["display"] == "graph":
g = workflow.get_execution_graph()
status = self.jsonify_workflow_status(workflow)
status["nodes"] = g.nodes()
status["edges"] = g.edges()
return status
def _webify_outputs(self, web_path, path):
......
......@@ -29,8 +29,6 @@ import jflow.utils as utils
from jflow.config_reader import JFlowConfigReader
class WorkflowsManager(object):
"""
"""
IDS_FILE_NAME = "jflowIDs.txt"
WORKFLOWS_DUMP_FILE_NAME = ".workflows.dump"
......@@ -40,8 +38,6 @@ class WorkflowsManager(object):
lock_workflows_file = threading.Lock()
def __init__(self):
"""
"""
self.config_reader = JFlowConfigReader()
if not os.path.isdir(self.get_output_directory()):
os.makedirs(self.get_output_directory(), 0751)
......@@ -112,10 +108,6 @@ class WorkflowsManager(object):
workflow = self.get_workflow(workflow_id)
return workflow.get_errors()
def get_workflow_ouputs(self, workflow_id):
workflow = self.get_workflow(workflow_id)
return workflow.get_outputs_per_components()
def get_output_directory(self):
return self.config_reader.get_work_directory()
......
......@@ -91,7 +91,7 @@
if (this.options.workflowID) { params = "workflow_id=" + this.options.workflowID + "&"; }
params += "display=" + this.options.display + "&";
$.ajax({
url: this.options.serverURL + '/get_workflows_status?'+params+'callback=?',
url: this.options.serverURL + '/get_workflow_status?'+params+'callback=?',
dataType: "json",
timeout: 20000,
error: function (xhr, ajaxOptions, thrownError) {
......@@ -151,7 +151,7 @@
if (this.options.workflowID) { params = "workflow_id=" + this.options.workflowID + "&"; }
params += "display=" + this.options.display + "&";
$.ajax({
url: this.options.serverURL + '/get_workflows_status?'+params+'callback=?',
url: this.options.serverURL + '/get_workflow_status?'+params+'callback=?',
dataType: "json",
timeout: 20000,
error: function (xhr, ajaxOptions, thrownError) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment