Skip to content

Commit

Permalink
Handle observer interruption
Browse files Browse the repository at this point in the history
  • Loading branch information
aristizabal95 committed Dec 6, 2023
1 parent 4b4a57e commit c37a0c2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cli/medperf/commands/dataset/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import sys
import signal
from pathlib import Path
from copy import deepcopy
from medperf.entities.dataset import Dataset
from medperf.enums import Status
import medperf.config as config
Expand All @@ -23,8 +22,9 @@


class ReportHandler(FileSystemEventHandler):
def __init__(self, preparation_obj: "DataPreparation"):
def __init__(self, preparation_obj: "DataPreparation", submission_approved):
self.preparation = preparation_obj
self.submission_approved = submission_approved

def on_created(self, event):
self.on_modified(event)
Expand Down Expand Up @@ -230,8 +230,8 @@ def sigint_handler(sig, frame):

if approved:
signal.signal(signal.SIGINT, sigint_handler)
observer.schedule(ReportHandler(self), self.out_path)
observer.start()
observer.schedule(ReportHandler(self, approved), self.out_path)
observer.start()

self.ui.text = "Running preparation step..."
try:
Expand Down Expand Up @@ -261,7 +261,7 @@ def sigint_handler(sig, frame):
self.ui.print("> Cube execution complete")

# If any observer or signal was set, stop them
signal.pause()
signal.signal(signal.SIGINT, signal.default_int_handler)
observer.stop()

# Send a last update to indicate preparation process finished
Expand Down

0 comments on commit c37a0c2

Please sign in to comment.