File: test_outputs.py

package info (click to toggle)
python-parsl 2025.01.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,072 kB
  • sloc: python: 23,817; makefile: 349; sh: 276; ansic: 45
file content (28 lines) | stat: -rw-r--r-- 645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
from concurrent.futures import wait

import pytest

from parsl import File, python_app


@python_app
def double(x, outputs=[]):
    with open(outputs[0], 'w') as f:
        f.write(x * 5)
    return x * 5


whitelist = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'configs', '*threads*')


@pytest.mark.shared_fs
def test_launch_apps(tmpd_cwd, n=2):
    outdir = tmpd_cwd / "outputs"
    outdir.mkdir()

    futs = [double(i, outputs=[File(str(outdir / f"{i}.txt"))]) for i in range(n)]
    wait(futs)

    stdout_file_count = len(list(outdir.glob("*.txt")))
    assert stdout_file_count == n, sorted(outdir.glob("*.txt"))