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

LIU-444: Add new Bash shell parsing approach. #309

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

myxie
Copy link
Collaborator

@myxie myxie commented Feb 5, 2025

JIRA Ticket

LIU-444

Type

  • Feature (addition)
  • Bug fix
  • Refactor (change)
  • Documentation

Problem/Issue

The current approach to managing BashShellApp command parsing is obfuscated and quite confusing. We both hard-code the port numbers of each in put in the bash command (e.g. "ls -l %i0 > %o0 ", where i0 is the 1st input/o0 is the 1st output) whilst also not having any knowledge of which port would be the first, second, third when translating.

It is also hard to understand how to perform redirection in the graph as we have a number of different redirection options. It would be great to replace this approach with a simplified way way of constructing the inputs/outputs, and the redirection.

Solution

This PR removes the redirection whilst replace all input/outputs with "%input_name%" options.

image

Here, %recursive% is a reference to the recursive parameter in the component (which is 'False').

Checklist

  • Unittests added
    • Reason for not adding unittests (remove this line if added)
  • Documentation added
    • Will be re-writing introductory documentation and will update accordingly soon.

Summary by Sourcery

Tests:

  • Update tests to reflect changes in Bash shell application execution.

This comment was marked as off-topic.

@coveralls
Copy link

coveralls commented Feb 10, 2025

Coverage Status

coverage: 78.596%. remained the same
when pulling 80be514 on LIU-444
into 927717d on master.

@myxie myxie changed the title (WIP) LIU-444: Add new Bash shell parsing approach. LIU-444: Add new Bash shell parsing approach. Feb 10, 2025
@myxie myxie marked this pull request as ready for review February 10, 2025 06:06
@myxie myxie requested a review from awicenec February 10, 2025 06:40
@myxie
Copy link
Collaborator Author

myxie commented Feb 10, 2025

Hi @awicenec, may you please review this PR when you have the time?


# Replace inputs/outputs in command line with paths or data URLs
cmd = droputils.replace_path_placeholders(cmd, fsInputs, fsOutputs)
for key, value in keyargs.items():
Copy link
Collaborator Author

@myxie myxie Feb 10, 2025

Choose a reason for hiding this comment

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

Set of instructions we discussed to produce replacement a la f-strings style:

>>> of = "my file" 
>>> s = "dd {of}"
>>> eval('f"'+s+'"')
>> 'dd my file'

I believe the issue with this approach is we do not have the actual variable names specified; they are keys in the dictionary, so we would have to construct variables dynamically and then perform the eval.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@awicenec to clarify - I think we can definitely replace the '%' with '{}' if you'd prefer that, so that it matches similar projects (e.g. Stimela); I just don't think we can do it with the eval.

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.

3 participants