File: test_radio_multiprocessing.py

package info (click to toggle)
python-parsl 2025.12.01%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,112 kB
  • sloc: python: 24,369; makefile: 352; sh: 252; ansic: 45
file content (44 lines) | stat: -rw-r--r-- 1,246 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
43
44
import pytest

from parsl.monitoring.message_type import MessageType
from parsl.monitoring.radios.multiprocessing import MultiprocessingQueueRadio
from parsl.multiprocessing import SpawnQueue


@pytest.mark.local
def test_radio(tmpd_cwd):
    """Test filesystem radio/receiver pair.
    This test checks that the pair can be started up locally, that a message
    is conveyed from radio to receiver, and that the receiver process goes
    away at shutdown.
    """

    resource_msgs = SpawnQueue()

    radio_config = MultiprocessingQueueRadio()

    # start receiver
    receiver = radio_config.create_receiver(run_dir=str(tmpd_cwd),
                                            resource_msgs=resource_msgs)

    # make radio

    radio_sender = radio_config.create_sender()

    # send message into radio

    message = (MessageType.RESOURCE_INFO, {})

    radio_sender.send(message)

    # verify it comes out of the receiver

    m = resource_msgs.get()

    assert m == message, "The sent message should appear in the queue"

    # Shut down router.
    # In the multiprocessing radio, nothing happens at shutdown, so this
    # validates that the call executes without raising an exception, but
    # not much else.
    receiver.shutdown()