Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable beeflow submit from working directory #854

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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