Skip to content

Commit

Permalink
_dynamic_info_firecrest_version updated
Browse files Browse the repository at this point in the history
  • Loading branch information
khsrali committed Aug 20, 2024
1 parent 151e5a6 commit 7331bc2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
29 changes: 22 additions & 7 deletions aiida_firecrest/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,31 @@ def _dynamic_info_firecrest_version(
small_file_size_mb=0.0,
api_version="100.0.0", # version is irrelevant here
)

parameters = transport._client.parameters()

Check warning on line 162 in aiida_firecrest/transport.py

View check run for this annotation

Codecov / codecov/patch

aiida_firecrest/transport.py#L162

Added line #L162 was not covered by tests
try:
transport.listdir(transport._cwd.joinpath(temp_directory), recursive=True)
_version = "1.16.0"
except Exception:
# all sort of exceptions can be raised here, but we don't care. Since this is just a workaround
_version = "1.15.0"
info = next(

Check warning on line 164 in aiida_firecrest/transport.py

View check run for this annotation

Codecov / codecov/patch

aiida_firecrest/transport.py#L164

Added line #L164 was not covered by tests
(
item
for item in parameters["general"] # type: ignore[typeddict-item]
if item["name"] == "FIRECREST_VERSION"
),
None,
)
if info is not None:
_version = str(info["value"])

Check warning on line 173 in aiida_firecrest/transport.py

View check run for this annotation

Codecov / codecov/patch

aiida_firecrest/transport.py#L172-L173

Added lines #L172 - L173 were not covered by tests
else:
raise KeyError
except KeyError as err:
raise click.BadParameter(

Check warning on line 177 in aiida_firecrest/transport.py

View check run for this annotation

Codecov / codecov/patch

aiida_firecrest/transport.py#L175-L177

Added lines #L175 - L177 were not covered by tests
"Could not get the version of the FirecREST server"
) from err

if parse(_version) < parse("1.15.0"):
raise click.BadParameter(f"FirecREST api version {_version} is not supported")

Check warning on line 182 in aiida_firecrest/transport.py

View check run for this annotation

Codecov / codecov/patch

aiida_firecrest/transport.py#L181-L182

Added lines #L181 - L182 were not covered by tests

click.echo(
click.style("Fireport: ", bold=True, fg="magenta")
+ f"Deployed version of FirecREST api: v{_version}"
click.style("Fireport: ", bold=True, fg="magenta") + f"FirecRESTapi: {_version}"
)
return _version

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exclude = [

[tool.ruff]
line-length = 120
extend-select = ["A", "B", "C4", "ICN", "ISC", "N", "RUF", "SIM"]
lint.extend-select = ["A", "B", "C4", "ICN", "ISC", "N", "RUF", "SIM"]
# extend-ignore = []

[tool.isort]
Expand Down
22 changes: 16 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,20 @@ def parameters(
"value": "Slurm",
}
],
"general": [
{
"description": "FirecREST version.",
"name": "FIRECREST_VERSION",
"unit": "",
"value": "v1.16.1-dev.9",
},
{
"description": "FirecREST build timestamp.",
"name": "FIRECREST_BUILD",
"unit": "",
"value": "2024-08-16T15:58:47Z",
},
],
"storage": [
{
"description": "Type of object storage, like `swift`, `s3v2` or `s3v4`.",
Expand Down Expand Up @@ -361,17 +375,13 @@ def parameters(
],
"utilities": [
{
"description": "The maximum allowable file size for various operations"
" of the utilities microservice",
"description": "The maximum allowable file size for various operations of the utilities microservice.",
"name": "UTILITIES_MAX_FILE_SIZE",
"unit": "MB",
"value": "5",
},
{
"description": (
"Maximum time duration for executing the commands "
"in the cluster for the utilities microservice."
),
"description": "Maximum time duration for executing the commands in the cluster for the utilities microservice.",
"name": "UTILITIES_TIMEOUT",
"unit": "seconds",
"value": "5",
Expand Down

0 comments on commit 7331bc2

Please sign in to comment.