Skip to content

Commit

Permalink
Merge pull request #854 from lanl/issue853/submit-within-dir
Browse files Browse the repository at this point in the history
Enable beeflow submit from working directory
  • Loading branch information
rstyd authored Jun 26, 2024
2 parents 03ab44c + 5c3bc06 commit 6ef63d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions beeflow/client/bee_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ def is_parent(parent, path):
path = os.path.abspath(path)
return os.path.commonpath([parent]) == os.path.commonpath([parent, path])

wf_path = wf_path.resolve()
workdir = workdir.resolve()

tarball_path = ""
if os.path.exists(wf_path):
# Check to see if the wf_path is a tarball or a directory. Package if directory
Expand All @@ -222,17 +225,15 @@ def is_parent(parent, path):
# Packaging in temp dir, after copying alternate cwl_main or yaml file
cwl_indir = is_parent(wf_path, main_cwl_path)
yaml_indir = is_parent(wf_path, yaml_path)
# Always create temp dir for the workflow
tempdir_path = pathlib.Path(tempfile.mkdtemp())
if cwl_indir and yaml_indir:
package_path = package(wf_path, tempdir_path)
else:
tempdir_wf_path = pathlib.Path(tempdir_path / wf_path.name)
shutil.copytree(wf_path, tempdir_wf_path, dirs_exist_ok=False)
if not cwl_indir:
shutil.copy2(main_cwl, tempdir_wf_path)
if not yaml_indir:
shutil.copy2(yaml, tempdir_wf_path)
package_path = package(tempdir_wf_path, tempdir_path)
tempdir_wf_path = pathlib.Path(tempdir_path / wf_name)
shutil.copytree(wf_path, tempdir_wf_path, dirs_exist_ok=False)
if not cwl_indir:
shutil.copy2(main_cwl, tempdir_wf_path)
if not yaml_indir:
shutil.copy2(yaml, tempdir_wf_path)
package_path = package(tempdir_wf_path, tempdir_path)
else:
package_path = wf_path
# Untar and parse workflow
Expand Down
2 changes: 1 addition & 1 deletion beeflow/common/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, name, path, main_cwl, job_file, workdir, containers):
self.path = path
self.main_cwl = main_cwl
self.job_file = job_file
self.workdir = workdir
self.workdir = Path(workdir)
self.containers = containers
self.wf_id = None
self.tarball = None
Expand Down

0 comments on commit 6ef63d6

Please sign in to comment.