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

Fix uri detection #37

Merged
merged 1 commit into from
Nov 30, 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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# `pylhc-submitter` Changelog

## Version 2.0.2

- Fixing `job_submitter`: Discovers more invalid URIs.

## Version 2.0.1

- Fixing job_submitter: type error in `print_stats`, when job-names are integers.
- Fixing `job_submitter`: type error in `print_stats`, when job-names are integers.

## Version 2.0.0

Expand Down
2 changes: 1 addition & 1 deletion pylhc_submitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__title__ = "pylhc_submitter"
__description__ = "pylhc-submitter contains scripts to simplify the creation and submission of jobs to HTCondor at CERN"
__url__ = "https://github.com/pylhc/submitter"
__version__ = "2.0.1"
__version__ = "2.0.2"
__author__ = "pylhc"
__author_email__ = "[email protected]"
__license__ = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion pylhc_submitter/job_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def check_opts(opt):
else:
mask_content = opt.mask

if is_eos_uri(opt.output_destination) and not ("://" in opt.output_destination and "//eos" in opt.output_destination):
if is_eos_uri(opt.output_destination) and not ("://" in opt.output_destination and "//eos/" in opt.output_destination):
raise ValueError(
"The 'output_destination' is an EOS-URI but missing '://' or '//eos' (double slashes?). "
)
Expand Down
24 changes: 15 additions & 9 deletions tests/unit/test_job_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,21 @@ def test_output_directory(tmp_path):

def test_detects_wrong_uri(tmp_path):
""" Tests that wrong URI's are identified. """
setup = InputParameters(
working_directory=tmp_path,
run_local=True,
output_destination="root:/eosuser.cern.ch/eos/my_new_output",
)
setup.create_mask()
with pytest.raises(ValueError) as e:
job_submit(**asdict(setup))
assert "EOS-URI" in str(e)
for test_uri in [
"root:/eosuser.cern.ch//eos/my_new_output/",
"root://eosuser.cern.ch/eos/my_new_output/",
"root:/eosuser.cern.ch/eos/my_new_output/",
]:
setup = InputParameters(
working_directory=tmp_path,
run_local=True,
output_destination=test_uri,
)
setup.create_mask()
with pytest.raises(ValueError) as e:
job_submit(**asdict(setup))
assert "EOS-URI" in str(e)



@run_only_on_linux
Expand Down