Skip to content

Commit 2c79f32

Browse files
committed
Merge branch 'main' of github.com:ExaWorks/psij-python into main
2 parents 7bfcbfa + 8dd66b4 commit 2c79f32

File tree

6 files changed

+34
-15
lines changed

6 files changed

+34
-15
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ details how to contribute in a standardized and efficient manner.
1111
- Ensure that you've opened an Issue on Github and consensus around the
1212
solution has be reached.
1313
- Minor changes (e.g., grammatical fixes) do not require an Issue first.
14-
- [Create your own
15-
fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo).
16-
- When you are starting a new set of changes, [fetch any changes from the
17-
upstream
18-
repo](https://matplotlib.org/stable/devel/gitwash/development_workflow.html#update-the-mirror-of-trunk),
19-
and [start a new feature branch on your fork from
20-
that](https://matplotlib.org/stable/devel/gitwash/development_workflow.html#make-a-new-feature-branch).
2114
- Make a new branch for each separable set of changes — ["one task, one
2215
branch"](https://mail.python.org/pipermail/ipython-dev/2010-October/005632.html).
2316
- [Each commit should make one change](https://dev.to/ruanbrandao/how-to-make-good-git-commits-256k).

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Testing / QA
88
-r requirements-tests.txt
99
mypy >=0.931
10-
flake8
10+
flake8==5.0.4
1111
flake8-docstrings
1212
autopep8
1313
types-requests

scripts/WORKFLOW-EXAMPLES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ RUN pip install wordcloud
100100

101101
## Executing a singularity container
102102

103-
We will run the PDF2Wordcloud example in a container. We will use the docker conatiner described above and execute it with singularity. In this case the spec defines the execution of a container with singularity. The actual command line tool is passed as an optional argument after all requiered singularity options.
103+
We will run the PDF2Wordcloud example in a container. We will use the docker container described above and execute it with singularity. In this case the spec defines the execution of a container with singularity. The actual command line tool is passed as an optional argument after all requiered singularity options.
104104

105105
```
106106
...

src/psij/executors/flux.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,15 @@ def list(self) -> List[str]:
177177
178178
:return: The list of known tasks.
179179
"""
180-
return [x["id"] for x in flux.job.job_list(self._fh)]
180+
return [
181+
x["id"]
182+
for x in flux.job.job_list(
183+
self._fh,
184+
max_entries=100000,
185+
attrs=[],
186+
states=flux.constants.FLUX_JOB_STATE_ACTIVE,
187+
).get()["jobs"]
188+
]
181189

182190
def attach(self, job: Job, native_id: str) -> None:
183191
"""

tests/_test_tools.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ def assert_completed(job: Job, status: Optional[JobStatus]) -> None:
3838
% (status.message, stdout, stderr))
3939

4040

41-
def _get_executor_instance(ep: ExecutorTestParams, job: Job) -> JobExecutor:
42-
assert job.spec is not None
43-
job.spec.launcher = ep.launcher
44-
job.spec.attributes = JobAttributes(custom_attributes=ep.custom_attributes)
41+
def _get_executor_instance(ep: ExecutorTestParams, job: Optional[Job] = None) -> JobExecutor:
42+
if job is not None:
43+
assert job.spec is not None
44+
job.spec.launcher = ep.launcher
45+
job.spec.attributes = JobAttributes(custom_attributes=ep.custom_attributes)
4546
return JobExecutor.get_instance(ep.executor, url=ep.url)

tests/test_executor.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ def test_simple_job_redirect(execparams: ExecutorTestParams) -> None:
3232

3333

3434
def test_attach(execparams: ExecutorTestParams) -> None:
35+
job1 = Job(JobSpec(executable='/bin/sleep', arguments=['1']))
36+
ex = _get_executor_instance(execparams, job1)
37+
ex.submit(job1)
38+
job1.wait(target_states=[JobState.ACTIVE, JobState.COMPLETED])
39+
native_id = job1.native_id
40+
41+
assert native_id is not None
42+
job2 = Job()
43+
ex.attach(job2, native_id)
44+
status2 = job2.wait(timeout=_get_timeout(execparams))
45+
assert_completed(job2, status2)
46+
status1 = job1.wait(timeout=_get_timeout(execparams))
47+
assert_completed(job1, status1)
48+
49+
50+
def test_attach2(execparams: ExecutorTestParams) -> None:
3551
job = Job(JobSpec(executable='/bin/sleep', arguments=['1']))
3652
ex = _get_executor_instance(execparams, job)
3753
ex.submit(job)
@@ -40,7 +56,8 @@ def test_attach(execparams: ExecutorTestParams) -> None:
4056

4157
assert native_id is not None
4258
job2 = Job()
43-
ex.attach(job2, native_id)
59+
ex2 = _get_executor_instance(execparams)
60+
ex2.attach(job2, native_id)
4461
status = job2.wait(timeout=_get_timeout(execparams))
4562
assert_completed(job2, status)
4663

0 commit comments

Comments
 (0)