File: test_python_checkpoint_1.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 (34 lines) | stat: -rw-r--r-- 746 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
29
30
31
32
33
34
import os

import pytest

import parsl
from parsl import python_app
from parsl.tests.configs.local_threads import fresh_config


def local_config():
    config = fresh_config()
    config.checkpoint_mode = "manual"
    return config


@python_app(cache=True)
def uuid_app():
    import uuid
    return uuid.uuid4()


@pytest.mark.local
def test_initial_checkpoint_write():
    """1. Launch a few apps and write the checkpoint once a few have completed
    """
    uuid_app().result()

    cpt_dir = parsl.dfk().checkpoint()

    cptpath = cpt_dir + '/dfk.pkl'
    assert os.path.exists(cptpath), f"DFK checkpoint missing: {cptpath}"

    cptpath = cpt_dir + '/tasks.pkl'
    assert os.path.exists(cptpath), f"Tasks checkpoint missing: {cptpath}"