diracx-cli 0.0.1a19__tar.gz → 0.0.1a21__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/PKG-INFO +2 -2
  2. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/pyproject.toml +1 -1
  3. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/__init__.py +28 -6
  4. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/jobs.py +1 -1
  5. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx_cli.egg-info/PKG-INFO +2 -2
  6. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx_cli.egg-info/requires.txt +1 -1
  7. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/legacy/cs_sync/integration_test.cfg +1 -0
  8. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/legacy/cs_sync/integration_test.yaml +1 -0
  9. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/test_jobs.py +6 -2
  10. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/README.md +0 -0
  11. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/setup.cfg +0 -0
  12. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/__main__.py +0 -0
  13. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/config.py +0 -0
  14. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/internal/__init__.py +0 -0
  15. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/internal/legacy.py +0 -0
  16. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/py.typed +0 -0
  17. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx/cli/utils.py +0 -0
  18. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx_cli.egg-info/SOURCES.txt +0 -0
  19. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx_cli.egg-info/dependency_links.txt +0 -0
  20. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx_cli.egg-info/entry_points.txt +0 -0
  21. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/src/diracx_cli.egg-info/top_level.txt +0 -0
  22. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/legacy/cs_sync/integration_test_buggy.cfg +0 -0
  23. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/legacy/cs_sync/integration_test_secret.cfg +0 -0
  24. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/legacy/cs_sync/test_cssync.py +0 -0
  25. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/legacy/test_legacy.py +0 -0
  26. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/test_internal.py +0 -0
  27. {diracx_cli-0.0.1a19 → diracx_cli-0.0.1a21}/tests/test_login.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diracx-cli
3
- Version: 0.0.1a19
3
+ Version: 0.0.1a21
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -15,7 +15,7 @@ Requires-Dist: diracx-api
15
15
  Requires-Dist: diracx-client
16
16
  Requires-Dist: diracx-core
17
17
  Requires-Dist: gitpython
18
- Requires-Dist: pydantic
18
+ Requires-Dist: pydantic>=2.10
19
19
  Requires-Dist: rich
20
20
  Requires-Dist: typer
21
21
  Requires-Dist: pyyaml
@@ -18,7 +18,7 @@ dependencies = [
18
18
  "diracx-client",
19
19
  "diracx-core",
20
20
  "gitpython",
21
- "pydantic",
21
+ "pydantic>=2.10",
22
22
  "rich",
23
23
  "typer",
24
24
  "pyyaml",
@@ -10,7 +10,7 @@ from diracx.client.aio import DiracClient
10
10
  from diracx.client.models import DeviceFlowErrorResponse
11
11
  from diracx.core.extensions import select_from_extension
12
12
  from diracx.core.preferences import get_diracx_preferences
13
- from diracx.core.utils import write_credentials
13
+ from diracx.core.utils import read_credentials, write_credentials
14
14
 
15
15
  from .utils import AsyncTyper
16
16
 
@@ -38,12 +38,34 @@ def vo_callback(vo: str | None) -> str:
38
38
 
39
39
  @app.async_command()
40
40
  async def login(
41
- vo: Annotated[Optional[str], typer.Argument(callback=vo_callback)] = None,
42
- group: Optional[str] = None,
41
+ vo: Annotated[
42
+ Optional[str],
43
+ typer.Argument(callback=vo_callback, help="Virtual Organization name"),
44
+ ] = None,
45
+ group: Optional[str] = typer.Option(
46
+ None,
47
+ help="Group name within the VO. If not provided, the default group for the VO will be used.",
48
+ ),
43
49
  property: Optional[list[str]] = typer.Option(
44
- None, help="Override the default(s) with one or more properties"
50
+ None,
51
+ help=(
52
+ "List of properties to add to the default properties of the group. "
53
+ "If not provided, default properties of the group will be used."
54
+ ),
45
55
  ),
46
56
  ):
57
+ """Login to the DIRAC system using the device flow.
58
+
59
+ - If only VO is provided: Uses the default group and its properties for the VO.
60
+
61
+ - If VO and group are provided: Uses the specified group and its properties for the VO.
62
+
63
+ - If VO and properties are provided: Uses the default group and combines its properties with the
64
+ provided properties.
65
+
66
+ - If VO, group, and properties are provided: Uses the specified group and combines its properties with the
67
+ provided properties.
68
+ """
47
69
  scopes = [f"vo:{vo}"]
48
70
  if group:
49
71
  scopes.append(f"group:{group}")
@@ -94,11 +116,11 @@ async def logout():
94
116
  async with DiracClient() as api:
95
117
  credentials_path = get_diracx_preferences().credentials_path
96
118
  if credentials_path.exists():
97
- credentials = json.loads(credentials_path.read_text())
119
+ credentials = read_credentials(credentials_path)
98
120
 
99
121
  # Revoke refresh token
100
122
  try:
101
- await api.auth.revoke_refresh_token(credentials["refresh_token"])
123
+ await api.auth.revoke_refresh_token(credentials.refresh_token)
102
124
  except Exception as e:
103
125
  print(f"Error revoking the refresh token {e!r}")
104
126
  pass
@@ -152,7 +152,7 @@ def display_rich(data, content_range: ContentRange) -> None:
152
152
  async def submit(jdl: list[FileText]):
153
153
  async with DiracClient() as api:
154
154
  # api.valid(enforce_https=False)
155
- jobs = await api.jobs.submit_bulk_jobs([x.read() for x in jdl])
155
+ jobs = await api.jobs.submit_bulk_jdl_jobs([x.read() for x in jdl])
156
156
  print(
157
157
  f"Inserted {len(jobs)} jobs with ids: {','.join(map(str, (job.job_id for job in jobs)))}"
158
158
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diracx-cli
3
- Version: 0.0.1a19
3
+ Version: 0.0.1a21
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -15,7 +15,7 @@ Requires-Dist: diracx-api
15
15
  Requires-Dist: diracx-client
16
16
  Requires-Dist: diracx-core
17
17
  Requires-Dist: gitpython
18
- Requires-Dist: pydantic
18
+ Requires-Dist: pydantic>=2.10
19
19
  Requires-Dist: rich
20
20
  Requires-Dist: typer
21
21
  Requires-Dist: pyyaml
@@ -3,7 +3,7 @@ diracx-api
3
3
  diracx-client
4
4
  diracx-core
5
5
  gitpython
6
- pydantic
6
+ pydantic>=2.10
7
7
  rich
8
8
  typer
9
9
  pyyaml
@@ -1280,6 +1280,7 @@ Systems
1280
1280
  {
1281
1281
  #@@-prod - /C=ch/O=DIRAC/OU=DIRAC CI/CN=ciuser - 2023-10-02 12:36:08
1282
1282
  RescheduleDelays = 0
1283
+ MaxRescheduling = 3
1283
1284
  }
1284
1285
  }
1285
1286
  }
@@ -801,6 +801,7 @@ Systems:
801
801
  Optimizers:
802
802
  JobScheduling:
803
803
  RescheduleDelays: '0'
804
+ MaxRescheduling: '3'
804
805
  FailoverURLs: {}
805
806
  Services:
806
807
  Matcher:
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  import json
4
4
  import os
5
5
  import tempfile
6
+ from io import StringIO
6
7
 
7
8
  import pytest
8
9
  from pytest import raises
@@ -51,8 +52,11 @@ async def test_submit(with_cli_login, jdl_file, capfd):
51
52
  async def test_search(with_cli_login, jdl_file, capfd):
52
53
  """Test searching for jobs."""
53
54
  # Submit 20 jobs
54
- with open(jdl_file, "r") as temp_file:
55
- await cli.jobs.submit([temp_file] * 20)
55
+ with open(jdl_file, "r") as x:
56
+ what_we_submit = x.read()
57
+ jdls = [StringIO(what_we_submit) for _ in range(20)]
58
+
59
+ await cli.jobs.submit(jdls)
56
60
 
57
61
  cap = capfd.readouterr()
58
62
 
File without changes
File without changes