sfapi-client 0.3.0__tar.gz → 0.3.2__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.
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/PKG-INFO +2 -2
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/compute.py +3 -2
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/jobs.py +3 -1
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/client.py +1 -4
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/compute.py +3 -2
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/jobs.py +3 -1
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_jobs.py +4 -24
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_jobs_async.py +2 -15
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.github/dependabot.yml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.github/workflows/black.yml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.github/workflows/mkdocs.yml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.github/workflows/pypi.yml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.github/workflows/pytest.yml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.github/workflows/ruff.yml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.gitignore +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/.pre-commit-config.yaml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/LEGAL +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/LICENSE +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/README.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/community/contributing.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/examples/check_current_and_past_jobs.ipynb +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/examples/getting_bearer_token.ipynb +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/examples/run_job_and_check_status.ipynb +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/gen_examples.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/gen_sync.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/javascript/apiselector.js +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/quickstart/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/SUMMARY.txt +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/client/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/compute/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/exceptions/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/groups/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/jobs/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/paths/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/projects/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/resources/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/docs/reference/async/users/index.md +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/mkdocs.yml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/pyproject.toml +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/pytest.ini +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/requirements-dev.txt +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/scripts/run.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/__init__.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/__init__.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/client.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/groups.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/paths.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/projects.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_async/users.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_compute.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_jobs.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_models/__init__.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_models/job_status_response_sacct.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_models/job_status_response_squeue.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_models/resources.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_monitor.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/__init__.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/groups.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/paths.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/projects.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_sync/users.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_utils.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/client.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/compute.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/exceptions.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/groups.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/jobs.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/paths.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/projects.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/resources.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/users.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/conftest.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_api.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_api_async.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_client.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_client_async.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_compute.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_compute_async.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_groups.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_groups_async.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_key.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_paths.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_paths_async.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_projects.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_projects_async.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_resources.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_resources_async.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_users.py +0 -0
- {sfapi_client-0.3.0 → sfapi_client-0.3.2}/tests/test_users_async.py +0 -0
|
@@ -58,10 +58,11 @@ class AsyncCompute(ComputeBase):
|
|
|
58
58
|
json_response = r.json()
|
|
59
59
|
task = Task.model_validate(json_response)
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
status = task.status.lower()
|
|
62
|
+
if status in ["error", "failed"]:
|
|
62
63
|
raise SfApiError(task.result)
|
|
63
64
|
|
|
64
|
-
if
|
|
65
|
+
if status not in ["completed", "cancelled"]:
|
|
65
66
|
await _ASYNC_SLEEP(1)
|
|
66
67
|
continue
|
|
67
68
|
|
|
@@ -24,7 +24,9 @@ async def _fetch_raw_state(
|
|
|
24
24
|
partition: Optional[str] = None,
|
|
25
25
|
sacct: Optional[bool] = False,
|
|
26
26
|
):
|
|
27
|
-
|
|
27
|
+
# For now we are pass cached=False to ensure we don't
|
|
28
|
+
# break compatibility
|
|
29
|
+
params = {"sacct": sacct, "cached": False}
|
|
28
30
|
|
|
29
31
|
job_url = f"compute/jobs/{compute.name}"
|
|
30
32
|
|
|
@@ -383,10 +383,7 @@ class Client:
|
|
|
383
383
|
stop=tenacity.stop_after_attempt(MAX_RETRY),
|
|
384
384
|
)
|
|
385
385
|
def post(
|
|
386
|
-
self,
|
|
387
|
-
url: str,
|
|
388
|
-
data: Dict[str, Any] = None,
|
|
389
|
-
json: Dict[str, Any] = None
|
|
386
|
+
self, url: str, data: Dict[str, Any] = None, json: Dict[str, Any] = None
|
|
390
387
|
) -> httpx.Response:
|
|
391
388
|
client = self._http_client()
|
|
392
389
|
|
|
@@ -58,10 +58,11 @@ class Compute(ComputeBase):
|
|
|
58
58
|
json_response = r.json()
|
|
59
59
|
task = Task.model_validate(json_response)
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
status = task.status.lower()
|
|
62
|
+
if status in ["error", "failed"]:
|
|
62
63
|
raise SfApiError(task.result)
|
|
63
64
|
|
|
64
|
-
if
|
|
65
|
+
if status not in ["completed", "cancelled"]:
|
|
65
66
|
_SLEEP(1)
|
|
66
67
|
continue
|
|
67
68
|
|
|
@@ -24,7 +24,9 @@ def _fetch_raw_state(
|
|
|
24
24
|
partition: Optional[str] = None,
|
|
25
25
|
sacct: Optional[bool] = False,
|
|
26
26
|
):
|
|
27
|
-
|
|
27
|
+
# For now we are pass cached=False to ensure we don't
|
|
28
|
+
# break compatibility
|
|
29
|
+
params = {"sacct": sacct, "cached": False}
|
|
28
30
|
|
|
29
31
|
job_url = f"compute/jobs/{compute.name}"
|
|
30
32
|
|
|
@@ -2,7 +2,6 @@ import pytest
|
|
|
2
2
|
from concurrent.futures import ThreadPoolExecutor
|
|
3
3
|
import time
|
|
4
4
|
|
|
5
|
-
from sfapi_client import Client
|
|
6
5
|
from sfapi_client.jobs import JobState
|
|
7
6
|
from sfapi_client.compute import Compute
|
|
8
7
|
from sfapi_client.jobs import JobSqueue
|
|
@@ -52,22 +51,13 @@ def test_complete_timeout(authenticated_client, test_job_path, test_machine):
|
|
|
52
51
|
job.complete(timeout=10)
|
|
53
52
|
|
|
54
53
|
|
|
55
|
-
@pytest.mark.api_dev
|
|
56
54
|
def test_job_monitor_check_request(
|
|
57
55
|
mocker,
|
|
58
|
-
|
|
59
|
-
dev_client_secret,
|
|
56
|
+
authenticated_client,
|
|
60
57
|
test_job_path,
|
|
61
58
|
test_machine,
|
|
62
|
-
dev_api_url,
|
|
63
|
-
dev_token_url,
|
|
64
59
|
):
|
|
65
|
-
with
|
|
66
|
-
client_id=dev_client_id,
|
|
67
|
-
secret=dev_client_secret,
|
|
68
|
-
api_base_url=dev_api_url,
|
|
69
|
-
token_url=dev_token_url,
|
|
70
|
-
) as client:
|
|
60
|
+
with authenticated_client as client:
|
|
71
61
|
num_jobs = 10
|
|
72
62
|
_fetch_jobs = mocker.patch("sfapi_client._monitor._fetch_jobs")
|
|
73
63
|
|
|
@@ -122,24 +112,14 @@ def test_job_monitor_check_request(
|
|
|
122
112
|
assert len(ids) == num_jobs
|
|
123
113
|
|
|
124
114
|
|
|
125
|
-
# We currently run this in api-dev as its a new feature deployed there
|
|
126
|
-
@pytest.mark.api_dev
|
|
127
115
|
def test_job_monitor_multiple_threads(
|
|
128
|
-
|
|
129
|
-
dev_client_secret,
|
|
116
|
+
authenticated_client,
|
|
130
117
|
test_job_path,
|
|
131
118
|
test_machine,
|
|
132
|
-
dev_api_url,
|
|
133
|
-
dev_token_url,
|
|
134
119
|
):
|
|
135
120
|
num_jobs = 5
|
|
136
121
|
|
|
137
|
-
with
|
|
138
|
-
client_id=dev_client_id,
|
|
139
|
-
secret=dev_client_secret,
|
|
140
|
-
api_base_url=dev_api_url,
|
|
141
|
-
token_url=dev_token_url,
|
|
142
|
-
) as client:
|
|
122
|
+
with authenticated_client as client:
|
|
143
123
|
machine = client.compute(test_machine)
|
|
144
124
|
|
|
145
125
|
jobs = []
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
import asyncio
|
|
3
3
|
|
|
4
|
-
from sfapi_client import AsyncClient
|
|
5
4
|
from sfapi_client.compute import AsyncCompute
|
|
6
5
|
from sfapi_client.jobs import AsyncJobSqueue, AsyncJobSacct, JobState
|
|
7
6
|
|
|
@@ -162,23 +161,11 @@ async def test_job_monitor_job_types(async_authenticated_client, mocker, test_ma
|
|
|
162
161
|
assert kwargs["job_type"] == AsyncJobSacct
|
|
163
162
|
|
|
164
163
|
|
|
165
|
-
# We currently run this in api-dev as its a new feature deployed there
|
|
166
|
-
@pytest.mark.api_dev
|
|
167
164
|
@pytest.mark.asyncio
|
|
168
165
|
async def test_job_monitor_gather(
|
|
169
|
-
|
|
170
|
-
dev_client_secret,
|
|
171
|
-
test_job_path,
|
|
172
|
-
test_machine,
|
|
173
|
-
dev_api_url,
|
|
174
|
-
dev_token_url,
|
|
166
|
+
async_authenticated_client, test_job_path, test_machine
|
|
175
167
|
):
|
|
176
|
-
async with
|
|
177
|
-
client_id=dev_client_id,
|
|
178
|
-
secret=dev_client_secret,
|
|
179
|
-
api_base_url=dev_api_url,
|
|
180
|
-
token_url=dev_token_url,
|
|
181
|
-
) as client:
|
|
168
|
+
async with async_authenticated_client as client:
|
|
182
169
|
machine = await client.compute(test_machine)
|
|
183
170
|
|
|
184
171
|
submit_tasks = []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_models/job_status_response_sacct.py
RENAMED
|
File without changes
|
{sfapi_client-0.3.0 → sfapi_client-0.3.2}/src/sfapi_client/_models/job_status_response_squeue.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|