File tree 4 files changed +7
-4
lines changed
4 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 10
10
from octue .cloud .events .attributes import ResponseAttributes
11
11
from octue .cloud .events .handler import AbstractEventHandler
12
12
from octue .cloud .events .validation import SERVICE_COMMUNICATION_SCHEMA
13
+ from octue .definitions import DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL
13
14
from octue .utils .decoders import OctueJSONDecoder
14
15
from octue .utils .objects import get_nested_attribute
15
16
from octue .utils .threads import RepeatingTimer
@@ -110,7 +111,7 @@ def _time_since_last_heartbeat(self):
110
111
111
112
return datetime .now () - self ._last_heartbeat
112
113
113
- def handle_events (self , timeout = 60 , maximum_heartbeat_interval = 360 ):
114
+ def handle_events (self , timeout = 60 , maximum_heartbeat_interval = DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL ):
114
115
"""Pull events from the subscription and handle them in the order they were sent until a "result" event is
115
116
handled, then return the handled result.
116
117
Original file line number Diff line number Diff line change 24
24
validate_sruid ,
25
25
)
26
26
from octue .compatibility import warn_if_incompatible
27
- from octue .definitions import LOCAL_SDK_VERSION
27
+ from octue .definitions import DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL , LOCAL_SDK_VERSION
28
28
import octue .exceptions
29
29
from octue .utils .dictionaries import make_minimal_dictionary
30
30
from octue .utils .encoders import OctueJSONEncoder
@@ -383,7 +383,7 @@ def wait_for_answer(
383
383
handle_monitor_message = None ,
384
384
record_events = True ,
385
385
timeout = 60 ,
386
- maximum_heartbeat_interval = 360 ,
386
+ maximum_heartbeat_interval = DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL ,
387
387
):
388
388
"""Wait for an answer to a question on the given subscription, deleting the subscription and its topic once
389
389
the answer is received.
Original file line number Diff line number Diff line change 20
20
21
21
GOOGLE_COMPUTE_PROVIDERS = {"GOOGLE_CLOUD_FUNCTION" }
22
22
LOCAL_SDK_VERSION = importlib .metadata .version ("octue" )
23
+ DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL = 360
Original file line number Diff line number Diff line change 4
4
import os
5
5
6
6
from octue .cloud .pub_sub .service import Service
7
+ from octue .definitions import DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL
7
8
from octue .resources import service_backends
8
9
9
10
logger = logging .getLogger (__name__ )
@@ -76,7 +77,7 @@ def ask(
76
77
prevent_retries_when = None ,
77
78
log_errors = True ,
78
79
timeout = 86400 ,
79
- maximum_heartbeat_interval = 360 ,
80
+ maximum_heartbeat_interval = DEFAULT_MAXIMUM_HEARTBEAT_INTERVAL ,
80
81
):
81
82
"""Ask the child either:
82
83
- A synchronous (ask-and-wait) question and wait for it to return an output. Questions are synchronous if
You can’t perform that action at this time.
0 commit comments