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

DM-39885: Fully substitute symbolic environment variables in symbolic filenames #17

Merged
merged 2 commits into from Jul 6, 2023

Conversation

mxk62
Copy link
Contributor

@mxk62 mxk62 commented Jul 5, 2023

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

# symbolic names. As a result, more than one iteration may be required
# to resolve all symbolic names. For example, an actual value for
# a filename may contain a symbolic name for an environment variable.
while re.search(_env_regex, command) or re.search(_file_regex, command):
Copy link
Member

Choose a reason for hiding this comment

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

Just a thought, but instead of repeating the search here and in the re.sub lines, maybe another option for the while is to loop until command stops changing? ie something like (untested):

prev_command = command
while True:
    command = re.sub(...)
    command = re.sub(...)
    if command == prev_command:
        break
    prev_command = command

There may be a neater way to organize things but it seems better than running the regexes twice as often.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I could use this version instead.

BTW, just out of curiosity, I timed both version with timeit. For a fairly short string like for example

<ENV:CTRL_MPEXEC_DIR>/bin/pipetask --long-log --log-level=VERBOSE pre-exec-init-qbb <FILE:butlerConfig> <FILE:runQgraphFile>

your version is ~10% faster than mine, i.e., it took 11.41 s to complete 1,000,000 executions for my version and 10.31 s for yours.

Copy link
Member

Choose a reason for hiding this comment

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

So most of the overhead is in the re.sub. I do think that "no string was replaced" is a neater end state since that's what you are actually wanting.

@timj
Copy link
Member

timj commented Jul 5, 2023

I have fixes for the docstyle and build_sphinx_docs failures on #16.

The build failure is caused by pydantic 2.0 being pulled in from the pypi daf_butler. This should work fine once a new PyPI release is made tonight.

@timj timj changed the title DM-39885: ctrl_bps_parsl does not substitue symbolic environment variables in symbolic filenames DM-39885: Fully substitute symbolic environment variables in symbolic filenames Jul 6, 2023
@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (c1e1701) 69.23% compared to head (54f76d9) 69.23%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #17   +/-   ##
=======================================
  Coverage   69.23%   69.23%           
=======================================
  Files           3        3           
  Lines          26       26           
  Branches        6        6           
=======================================
  Hits           18       18           
  Misses          6        6           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mxk62 mxk62 merged commit 1333863 into main Jul 6, 2023
13 checks passed
@mxk62 mxk62 deleted the tickets/DM-39885 branch July 6, 2023 21:03
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.

None yet

2 participants