-
Notifications
You must be signed in to change notification settings - Fork 3
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
beeflow:useContainer support for SquashFS #990
Open
arhall0
wants to merge
2
commits into
develop
Choose a base branch
from
967-add-capability-to-run-applications-that-are-charliecloud-sqfs-format-dockerrequirement-for-tasks
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
"""Charliecloud driver tests.""" | ||
import pytest | ||
from beeflow.common.crt.charliecloud_driver import CharliecloudDriver as crt_driver | ||
from beeflow.common.wf_data import Task, Requirement | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"use_container, pre_commands_exp, main_command_exp, post_commands_exp", | ||
[ | ||
("cont.sqfs", "", "ch-run cont.sqfs env --cd -b : -- default", ""), | ||
( | ||
"cont.tar.gz", | ||
"mkdir -p env one-per-node ch-convert -i tar -o dir cont.tar.gz env/cont one-per-node", | ||
"ch-run env/cont env --cd -b : -- default", | ||
"rm -rf env/cont one-per-node", | ||
), | ||
], | ||
) | ||
def test_run_text_use_container( | ||
mocker, tmpdir, use_container, pre_commands_exp, main_command_exp, post_commands_exp | ||
): | ||
"""Test run_text with different useContainer DockerRequirements.""" | ||
tmpdir_str = str(tmpdir) | ||
mocker.patch("beeflow.common.config_driver.BeeConfig.get", return_value="env") | ||
mocker.patch( | ||
"beeflow.common.config_driver.BeeConfig.resolve_path", return_value=tmpdir_str | ||
) | ||
mocker.patch("os.getenv", return_value=str(tmpdir)) | ||
requirements = [ | ||
Requirement( | ||
"DockerRequirement", | ||
{ | ||
"beeflow:containerName": None, | ||
"beeflow:bindMounts": None, | ||
"beeflow:copyContainer": None, | ||
"dockerPull": None, | ||
"beeflow:useContainer": use_container, | ||
}, | ||
) | ||
] | ||
task = Task( | ||
name="", | ||
base_command="", | ||
hints=[], | ||
requirements=requirements, | ||
inputs=[], | ||
outputs=[], | ||
stdout="", | ||
stderr="", | ||
workflow_id="", | ||
workdir=tmpdir, | ||
) | ||
driver = crt_driver() | ||
res = driver.run_text(task) | ||
assert res.env_code.count(tmpdir_str) == 1 | ||
# simplify results for easier comparison | ||
env_code = res.env_code.replace(tmpdir_str, "").replace("\n", " ") | ||
pre_commands = " ".join( | ||
[f'{" ".join(com.args)} {com.type}' for com in res.pre_commands] | ||
).replace(tmpdir_str, "") | ||
main_command = f'{" ".join(res.main_command.args)} {res.main_command.type}' | ||
assert main_command.count(tmpdir_str) == 3 | ||
main_command = main_command.replace(tmpdir_str, "") | ||
post_commands = " ".join( | ||
[f'{" ".join(com.args)} {com.type}' for com in res.post_commands] | ||
) | ||
assert env_code == "env cd " | ||
assert pre_commands == pre_commands_exp | ||
assert main_command == main_command_exp | ||
assert post_commands == post_commands_exp |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line needed anymore?