Skip to content

Commit

Permalink
Merge pull request #659 from radical-cybertools/fix/mock
Browse files Browse the repository at this point in the history
mock backend to use threads for proper termination
  • Loading branch information
andre-merzky authored Jan 30, 2024
2 parents a033a4b + 2a284e1 commit 562cc0a
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/radical/entk/execman/mock/task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import queue

import threading as mt
import multiprocessing as mp

from ...exceptions import EnTKError
from ... import states, Task
Expand Down Expand Up @@ -205,26 +204,26 @@ def start_manager(self):
in a separate thread using this method.
'''
# pylint: disable=attribute-defined-outside-init, access-member-before-definition
if self._tmgr_process:
if self._tmgr_thread:
self._log.warn('tmgr process already running!')
return

try:
self._prof.prof('creating tmgr process', uid=self._uid)
self._tmgr_terminate = mp.Event()
self._tmgr_terminate = mt.Event()

self._tmgr_process = mp.Process(target=self._tmgr,
name='task-manager',
args=(self._uid,
self._rmgr,
self._zmq_info)
)
self._tmgr_thread = mt.Thread(target=self._tmgr,
name='task-manager',
args=(self._uid,
self._rmgr,
self._zmq_info)
)

self._log.info('Starting task manager process')
self._prof.prof('starting tmgr process', uid=self._uid)

self._tmgr_process.start()
self._log.debug('tmgr pid %s', self._tmgr_process.pid)
self._tmgr_thread.start()
self._log.debug('tmgr thread %s', self._tmgr_thread.ident)

return True

Expand Down

0 comments on commit 562cc0a

Please sign in to comment.