Skip to content

Commit e00477a

Browse files
committed
Catch sigterm as well
not just catch ctrl+c but also sigterms coming from CI builds stopping the docker container running this
1 parent be9e344 commit e00477a

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

scripts/ci/run_targeting_aura_sessions.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ def main() -> None:
2424
instance_id = create_result["id"]
2525
logging.info(f"Creation of database with id '{instance_id}'")
2626

27-
# Teardown instance on SIGINT
28-
def handle_sigint(sig, frame):
29-
logging.info("Received SIGINT, tearing down instance")
27+
# Teardown instance on SIGNAL
28+
def handle_signal(sig, frame):
29+
logging.info("Received SIGNAL, tearing down instance")
3030
aura_api.teardown_instance(instance_id)
3131
sys.exit(1)
3232

33-
signal.signal(signal.SIGINT, handle_sigint)
33+
signal.signal(signal.SIGINT, handle_signal)
34+
signal.signal(signal.SIGTERM, handle_signal)
3435

3536
try:
3637
aura_api.check_running(instance_id)

scripts/ci/run_targeting_aurads.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ def main() -> None:
3939
instance_id = create_result["id"]
4040
logging.info("Creation of database accepted")
4141

42-
def handle_sigint(sig, frame):
43-
logging.info("Received SIGINT, tearing down instance")
42+
def handle_signal(sig, frame):
43+
logging.info("Received SIGNAL, tearing down instance")
4444
aura_api.teardown_instance(instance_id)
4545
sys.exit(1)
4646

47-
signal.signal(signal.SIGINT, handle_sigint)
47+
signal.signal(signal.SIGINT, handle_signal)
48+
signal.signal(signal.SIGTERM, handle_signal)
4849

4950
try:
5051
aura_api.check_running(instance_id)

scripts/run_notebooks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ def init_notebook(self, version_cell_index: int, tear_down_cells: List[IndexedCe
3232
def preprocess_cell(self, cell: Any, resources: Any, index: int) -> None:
3333
if index == 0:
3434

35-
def handle_sigint(sig, frame):
36-
print("Received SIGINT, running tear down cells")
35+
def handle_signal(sig, frame):
36+
print("Received SIGNAL, running tear down cells")
3737
self.teardown(resources)
3838
sys.exit(1)
3939

40-
signal.signal(signal.SIGINT, handle_sigint)
40+
signal.signal(signal.SIGINT, handle_signal)
41+
signal.signal(signal.SIGTERM, handle_signal)
4142

4243
try:
4344
if not self._skip_rest:

0 commit comments

Comments
 (0)