<commit_before>import os
from contextlib import contextmanager

from pytest import mark, raises

import parsl
from parsl.providers import LocalProvider
from parsl.channels import LocalChannel
from parsl.config import Config
from parsl.executors import HighThroughputExecutor
from parsl import python_app


@python_app()
def test_function():
    return os.getpid()


@contextmanager
def config(start_method: str, **kwargs):
    config = Config(
        executors=[
            HighThroughputExecutor(
                label="fork",
                worker_debug=True,
                max_workers=2,
                provider=LocalProvider(
                    channel=LocalChannel(),
                    init_blocks=1,
                    max_blocks=1,
                ),
                start_method="spawn"
            )
        ],
        strategy=None,
    )
    dfk = parsl.load(config)
    try:
        yield dfk
    finally:
        dfk.cleanup()
        parsl.clear()


@mark.local<commit_msg>Fix broken htex start method tests (#2458)<commit_after>import os
from contextlib import contextmanager

from pytest import mark, raises

import parsl
from parsl.providers import LocalProvider
from parsl.channels import LocalChannel
from parsl.config import Config
from parsl.executors import HighThroughputExecutor
from parsl import python_app


@python_app()
def test_function():
    return os.getpid()


@contextmanager
def config(start_method: str, **kwargs):
    my_config = Config(
        executors=[
            HighThroughputExecutor(
                label="fork",
                worker_debug=True,
                max_workers=2,
                provider=LocalProvider(
                    channel=LocalChannel(),
                    init_blocks=1,
                    max_blocks=1,
                ),
                start_method=start_method
            )
        ],
        strategy=None,
    )
    dfk = parsl.load(my_config)
    try:
        yield dfk
    finally:
        dfk.cleanup()
        parsl.clear()


@mark.local
{'fraction_non_alphanumeric': 0.07227138643067847, 'fraction_numerical': 0.004916420845624385, 'mean_word_length': 1.9708029197080292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4425674', 'n_tokens_mistral': 566, 'n_tokens_neox': 537, 'n_words': 135}