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

Allowing running flowchart.flow in the current directory #155

Merged
merged 1 commit into from
Nov 14, 2023
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
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
=======
History
=======
2023.11.12 -- Allowing running flowchart.flow in current directory
* There was a feature which prevented running a flowchart named "flowchart.flow" in
the current directory when running from the commandline.

2023.11.11 -- Incorporating changes to Zenodo
* Zenodo updated and made small changes to their API, which required changes in
SEAMM.
Expand Down
16 changes: 11 additions & 5 deletions seamm/run_flowchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,17 @@ def run(
printer.job(datetime.now().strftime("%A %Y.%m.%d %H:%M:%S %Z"))
printer.job("Running in directory '{}'".format(wdir))

flowchart_path = os.path.join(wdir, "flowchart.flow")
flowchart_path = Path(wdir).resolve() / "flowchart.flow"
path = Path(sys.argv[0]).resolve()

# copy the flowchart to the root directory for later reference
if not in_jobserver:
shutil.copy2(sys.argv[0], flowchart_path)
# copy the flowchart to the root directory if it is not there already
if not in_jobserver and flowchart_path.exists() and path != flowchart_path:
shutil.copy2(path, flowchart_path)

# Make executable if it isn't
permissions = flowchart_path.stat().st_mode
if permissions & 0o100 == 0:
flowchart_path.chmod(permissions | 0o110)

logger.info(f" reading in flowchart '{flowchart_path}' -- 2")
flowchart = seamm.Flowchart(directory=wdir)
Expand Down Expand Up @@ -357,7 +363,7 @@ def run(
with seamm_datastore.session_scope(db.Session) as session:
job = db.Job.create(
job_id,
flowchart_path,
str(flowchart_path),
project_names=data["projects"],
path=wdir,
title=title,
Expand Down