Skip to content

Commit

Permalink
Make FilesystemRadio serialize monitoring messages the same as UDP an…
Browse files Browse the repository at this point in the history
…d HTEX radios (#3679)

UDP and HTEX radios both use pickle, not parsl.serialize, and there is
no reason for this inconsistency.

## Type of change

- Code maintenance/cleanup
  • Loading branch information
benclifford authored Nov 7, 2024
1 parent 831953f commit 640d839
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions parsl/monitoring/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import multiprocessing.synchronize as ms
import os
import pickle
import queue
import time
from multiprocessing import Event, Process
Expand All @@ -18,7 +19,6 @@
from parsl.monitoring.types import TaggedMonitoringMessage
from parsl.multiprocessing import ForkProcess, SizedQueue
from parsl.process_loggers import wrap_with_logs
from parsl.serialize import deserialize
from parsl.utils import RepresentationMixin, setproctitle

_db_manager_excepts: Optional[Exception]
Expand Down Expand Up @@ -282,7 +282,7 @@ def filesystem_receiver(logdir: str, q: "queue.Queue[TaggedMonitoringMessage]",
logger.info("Processing filesystem radio file %s", filename)
full_path_filename = f"{new_dir}/{filename}"
with open(full_path_filename, "rb") as f:
message = deserialize(f.read())
message = pickle.load(f)
logger.debug("Message received is: %s", message)
assert isinstance(message, tuple)
q.put(cast(TaggedMonitoringMessage, message))
Expand Down
4 changes: 1 addition & 3 deletions parsl/monitoring/radios.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import zmq

from parsl.serialize import serialize

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -59,7 +57,7 @@ def send(self, message: object) -> None:
# move it into new/, so that a partially written
# file will never be observed in new/
with open(tmp_filename, "wb") as f:
f.write(serialize(buffer))
pickle.dump(buffer, f)
os.rename(tmp_filename, new_filename)


Expand Down

0 comments on commit 640d839

Please sign in to comment.