Skip to content

Commit

Permalink
Save state before cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
GeigerJ2 committed Nov 4, 2024
1 parent b0d077e commit 9a9eb16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions src/aiida/engine/processes/calcjobs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,28 @@ async def task_submit_job(node: CalcJobNode, transport_queue: TransportQueue, ca
max_attempts = get_config_option(MAX_ATTEMPTS_OPTION)

authinfo = node.get_authinfo()
authinfo_pk = authinfo.pk

transport_request = transport_queue._transport_requests.get(authinfo.pk, None)
open_transport = transport_queue._open_transports.get(authinfo.pk, None)

if open_transport is not None: # and not transport_queue._last_request_special:
transport = open_transport
transport_queue._last_request_special = True
elif transport_request is None: # or transport_queue._last_request_special:
# This is the previous behavior
with transport_queue.request_transport(authinfo) as request:
transport = await cancellable.with_interrupt(request)
else:
pass
# authinfo_pk = authinfo.pk

# transport_request = transport_queue._transport_requests.get(authinfo.pk, None)
# open_transport = transport_queue._open_transports.get(authinfo.pk, None)

# if open_transport is not None: # and not transport_queue._last_request_special:
# transport = open_transport
# transport_queue._last_request_special = True
# elif transport_request is None: # or transport_queue._last_request_special:
# # This is the previous behavior
# with transport_queue.request_transport(authinfo) as request:
# transport = await cancellable.with_interrupt(request)
# else:
# pass

async def do_submit():
transport_request = transport_queue._transport_requests.get(authinfo.pk, None)
open_transport = transport_queue._open_transports.get(authinfo.pk, None)

if open_transport is not None: # and not transport_queue._last_request_special:
transport = open_transport
transport_queue._last_request_special = True
# transport_queue._last_request_special = True
elif transport_request is None: # or transport_queue._last_request_special:
# This is the previous behavior
with transport_queue.request_transport(authinfo) as request:
Expand Down
2 changes: 1 addition & 1 deletion src/aiida/engine/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def __init__(self, loop: Optional[asyncio.AbstractEventLoop] = None):
""":param loop: An asyncio event, will use `asyncio.get_event_loop()` if not supplied"""
self._loop = loop if loop is not None else asyncio.get_event_loop()
self._transport_requests: Dict[Hashable, TransportRequest] = {}
self._open_transports: Dict[Hashable, Transport] = {}
self._last_open_time = None
self._last_close_time = None
self._last_request_special: bool = False
self._close_callback_handle = None
self._open_transports: Dict[Hashable, Transport] = {}
# self._last_transport_request: Dict[Hashable, str] = {}

@property
Expand Down

0 comments on commit 9a9eb16

Please sign in to comment.