Skip to content

Commit

Permalink
Typing todo note
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Dec 27, 2024
1 parent d953f06 commit 7aba1e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/plumpy/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ def broadcast_send(
) -> Any: ...

def task_send(self, task: Any, no_reply: bool = False) -> Any: ...

def close(self) -> None: ...
10 changes: 6 additions & 4 deletions src/plumpy/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def init(self) -> None:
self.add_cleanup(functools.partial(self._coordinator.remove_rpc_subscriber, identifier))
except concurrent.futures.TimeoutError:
self.logger.exception('Process<%s>: failed to register as an RPC subscriber', self.pid)
# XXX: handle duplicate subscribing here: see aiida-core test_duplicate_subscriber_identifier.

try:
# filter out state change broadcasts
Expand Down Expand Up @@ -1032,6 +1033,7 @@ async def run_callback() -> None:
except Exception as exc:
import traceback
import inspect

# Get traceback as a string
tb_str = ''.join(traceback.format_exception(type(exc), exc, exc.__traceback__))

Expand All @@ -1042,15 +1044,15 @@ async def run_callback() -> None:
source_file = inspect.getfile(callback)
# getsourcelines returns a tuple (list_of_source_lines, starting_line_number)
_, start_line = inspect.getsourcelines(callback)
callback_location = f"{source_file}:{start_line}"
callback_location = f'{source_file}:{start_line}'
except Exception:
callback_location = "<unknown location>"
callback_location = '<unknown location>'

# Include the callback name, file/line info, and the full traceback in the message
raise RuntimeError(
f"Error invoking callback '{callback.__name__}' at {callback_location}.\n"
f"Exception: {type(exc).__name__}: {exc}\n\n"
f"Full Traceback:\n{tb_str}"
f'Exception: {type(exc).__name__}: {exc}\n\n'
f'Full Traceback:\n{tb_str}'
) from exc
else:
while asyncio.isfuture(result):
Expand Down
2 changes: 2 additions & 0 deletions src/plumpy/rmq/process_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ProcessStatus = Any


# FIXME: the class not fit typing of ProcessController protocol
class RemoteProcessController:
"""
Control remote processes using coroutines that will send messages and wait
Expand Down Expand Up @@ -189,6 +190,7 @@ async def execute_process(
return result


# FIXME: the class not fit typing of ProcessController protocol
class RemoteProcessThreadController:
"""
A class that can be used to control and launch remote processes
Expand Down

0 comments on commit 7aba1e8

Please sign in to comment.