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

Factory: also parse command-line options #2060

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Factory: also parse command-line options #2060

wants to merge 1 commit into from

Conversation

mr-c
Copy link
Member

@mr-c mr-c commented Oct 24, 2024

Re-do of #1099

@mr-c mr-c mentioned this pull request Oct 24, 2024
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 8 lines in your changes missing coverage. Please review.

Project coverage is 83.97%. Comparing base (6cfef62) to head (dd80dea).

Files with missing lines Patch % Lines
cwltool/factory.py 80.95% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2060      +/-   ##
==========================================
- Coverage   83.99%   83.97%   -0.02%     
==========================================
  Files          46       46              
  Lines        8302     8332      +30     
  Branches     1957     1964       +7     
==========================================
+ Hits         6973     6997      +24     
- Misses        853      858       +5     
- Partials      476      477       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 98 to 127
self.runtime_context.find_default_container = functools.partial(
find_default_container, default_container=None, use_biocontainers=None
)

if sys.platform == "darwin":
default_mac_path = "/private/tmp/docker_tmp"
if self.runtimeContext.tmp_outdir_prefix == DEFAULT_TMP_PREFIX:
self.runtimeContext.tmp_outdir_prefix = default_mac_path

for dirprefix in ("tmpdir_prefix", "tmp_outdir_prefix", "cachedir"):
if (
getattr(self.runtime_context, dirprefix)
and getattr(self.runtime_context, dirprefix) != DEFAULT_TMP_PREFIX
):
sl = (
"/"
if getattr(self.runtime_context, dirprefix).endswith("/")
or dirprefix == "cachedir"
else ""
)
setattr(
self.runtime_context,
dirprefix,
os.path.abspath(getattr(self.runtime_context, dirprefix)) + sl,
)
if not os.path.exists(os.path.dirname(getattr(self.runtime_context, dirprefix))):
try:
os.makedirs(os.path.dirname(getattr(self.runtime_context, dirprefix)))
except Exception as e:
print("Failed to create directory: %s", e)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo, refactor this and the equivalent code from cwltool/main.py to a shared function. May need to look back to

if sys.platform == "darwin":
(when this PR was originally written) for inspiration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants