Skip to content

Commit

Permalink
Merge ca53cce into 05ec84c
Browse files Browse the repository at this point in the history
  • Loading branch information
giannisdoukas committed Jul 13, 2020
2 parents 05ec84c + ca53cce commit c1a371e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion cwlkernel/CWLKernel.py
Expand Up @@ -309,7 +309,6 @@ def send_text_to_stdout(self, text: str):

def __del__(self):
shutil.rmtree(self._session_dir, ignore_errors=True)
os.chdir(self._boot_directory.as_posix())


if __name__ == '__main__':
Expand Down
7 changes: 5 additions & 2 deletions cwlkernel/CoreExecutor.py
Expand Up @@ -103,6 +103,7 @@ def execute(self, provenance=False) -> Tuple[UUID, Dict, Optional[Exception], Op
:param provenance: Execute with provenance enabled/disabled.
:return: Run ID, dict with new files, exception if there is any.
"""
exception_to_return = None
run_id = uuid4()
factory: JupyterFactory
if not provenance:
Expand All @@ -114,6 +115,7 @@ def execute(self, provenance=False) -> Tuple[UUID, Dict, Optional[Exception], Op
self.file_manager.ROOT_DIRECTORY,
provenance_dir
)
old_directory = os.getcwd()
os.chdir(self.file_manager.ROOT_DIRECTORY)
executable = factory.make(self._workflow_path)
data = {}
Expand All @@ -123,14 +125,15 @@ def execute(self, provenance=False) -> Tuple[UUID, Dict, Optional[Exception], Op
data = {**new_data, **data}
try:
result: Dict = executable(**data)
e = None
except Exception as e:
traceback.print_exc(file=sys.stderr)
result = {}
exception_to_return = e

if provenance:
self._store_provenance(cast(ProvenanceFactory, factory), result)
return run_id, result, e, factory.runtime_context.research_obj
os.chdir(old_directory)
return run_id, result, exception_to_return, factory.runtime_context.research_obj

@classmethod
def _store_provenance(cls, factory: ProvenanceFactory, out) -> None:
Expand Down

0 comments on commit c1a371e

Please sign in to comment.