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

try to avoid nfs troubles

parent 40765a17
......@@ -803,8 +803,8 @@ class AbstractInputFile(AbstractIOFile):
tmp_directory = os.path.join(jflowconf.get_tmp_directory(), os.path.basename(tempfile.NamedTemporaryFile().name))
os.mkdir(tmp_directory)
file_path = os.path.join(tmp_directory, os.path.basename(uri_object.path))
local_file = open(file_path, 'wb')
if os.path.basename(uri_object.path) is not None and os.path.basename(uri_object.path) != "":
local_file = open(file_path, 'wb')
metadata = opener.info()
file_size = int(metadata.getheaders("Content-Length")[0])
while True:
......
......@@ -990,6 +990,8 @@ class Workflow(threading.Thread):
self._serialize()
try:
nest.execute(self.engine_arguments, exit_on_failure=True)
# close dag_file after execution to avoid nfs troubles
nest.dag_file.close()
except:
self.status = self.STATUS_FAILED
self.end_time = time.time()
......
......@@ -49,7 +49,9 @@ class WorkflowsManager(object):
WorkflowsManager.lock_workflows_file.acquire()
# first load the existing workflows
try:
workflows_dump = pickle.load(open(self.dump_file))
wdfh = open(self.dump_file)
workflows_dump = pickle.load(wdfh)
wdfh.close()
except:
workflows_dump = {}
# then add the new ones
......@@ -57,7 +59,9 @@ class WorkflowsManager(object):
workflows_dump[utils.get_nb_string(workflow.id)] = {"dump_path": workflow.dump_path,
"object": workflow.minimize()}
# and save them
pickle.dump(workflows_dump, open(self.dump_file, "w"))
wdfh = open(self.dump_file, "w")
pickle.dump(workflows_dump, wdfh)
wdfh.close()
WorkflowsManager.lock_workflows_file.release()
def get_available_workflows(self, function="process"):
......@@ -115,7 +119,9 @@ class WorkflowsManager(object):
from jflow.workflow import Workflow
WorkflowsManager.lock_workflows_file.acquire()
try:
all_workflows_dump = pickle.load(open(self.dump_file))
awfh = open(self.dump_file)
all_workflows_dump = pickle.load(awfh)
awfh.close()
except:
all_workflows_dump = {}
rworkflow_id = utils.get_nb_string(workflow_id)
......@@ -131,7 +137,9 @@ class WorkflowsManager(object):
logging.getLogger("jflow").debug("Workflow #" + rworkflow_id + " connot be retrieved in the available workflows!")
raise Exception("Workflow #" + rworkflow_id + " connot be retrieved in the available workflows!")
# and save them
pickle.dump(all_workflows_dump, open(self.dump_file, "w"))
awfh = open(self.dump_file, "w")
pickle.dump(all_workflows_dump, awfh)
awfh.close()
WorkflowsManager.lock_workflows_file.release()
def get_workflow_errors(self, workflow_id):
......@@ -181,7 +189,9 @@ class WorkflowsManager(object):
def get_workflow(self, workflow_id):
rworkflow_id = utils.get_nb_string(workflow_id)
try:
workflows_dump = pickle.load(open(self.dump_file))
wdfh = open(self.dump_file)
workflows_dump = pickle.load(wdfh)
wdfh.close()
except:
workflows_dump = {}
if workflows_dump.has_key(rworkflow_id):
......
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