-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into benc-remove-channels
Conflicts: parsl/channels/base.py parsl/channels/local/local.py parsl/tests/test_channels/test_large_output.py parsl/tests/test_channels/test_local_channel.py parsl/utils.py
- Loading branch information
Showing
24 changed files
with
266 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import logging | ||
from abc import ABCMeta, abstractmethod | ||
from typing import Optional | ||
|
||
_db_manager_excepts: Optional[Exception] | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class MonitoringRadioSender(metaclass=ABCMeta): | ||
@abstractmethod | ||
def send(self, message: object) -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import logging | ||
import os | ||
import pickle | ||
import uuid | ||
|
||
from parsl.monitoring.radios.base import MonitoringRadioSender | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class FilesystemRadioSender(MonitoringRadioSender): | ||
"""A MonitoringRadioSender that sends messages over a shared filesystem. | ||
The messsage directory structure is based on maildir, | ||
https://en.wikipedia.org/wiki/Maildir | ||
The writer creates a message in tmp/ and then when it is fully | ||
written, moves it atomically into new/ | ||
The reader ignores tmp/ and only reads and deletes messages from | ||
new/ | ||
This avoids a race condition of reading partially written messages. | ||
This radio is likely to give higher shared filesystem load compared to | ||
the UDP radio, but should be much more reliable. | ||
""" | ||
|
||
def __init__(self, *, monitoring_url: str, timeout: int = 10, run_dir: str): | ||
logger.info("filesystem based monitoring channel initializing") | ||
self.base_path = f"{run_dir}/monitor-fs-radio/" | ||
self.tmp_path = f"{self.base_path}/tmp" | ||
self.new_path = f"{self.base_path}/new" | ||
|
||
os.makedirs(self.tmp_path, exist_ok=True) | ||
os.makedirs(self.new_path, exist_ok=True) | ||
|
||
def send(self, message: object) -> None: | ||
logger.info("Sending a monitoring message via filesystem") | ||
|
||
unique_id = str(uuid.uuid4()) | ||
|
||
tmp_filename = f"{self.tmp_path}/{unique_id}" | ||
new_filename = f"{self.new_path}/{unique_id}" | ||
buffer = message | ||
|
||
# this will write the message out then atomically | ||
# move it into new/, so that a partially written | ||
# file will never be observed in new/ | ||
with open(tmp_filename, "wb") as f: | ||
pickle.dump(buffer, f) | ||
os.rename(tmp_filename, new_filename) |
Oops, something went wrong.