-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from ghrcdaac/mlh0079-cloud-ext
Mlh0079 cloud ext
- Loading branch information
Showing
3 changed files
with
100 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
import json | ||
import signal | ||
import sys | ||
import time | ||
from main import main | ||
|
||
class GracefulKiller: | ||
kill_now = False | ||
|
||
def __init__(self): | ||
signal.signal(signal.SIGINT, self.exit_gracefully) | ||
signal.signal(signal.SIGTERM, self.exit_gracefully) | ||
|
||
def exit_gracefully(self, signum, frame): | ||
print('Exiting gracefully') | ||
self.kill_now = True | ||
|
||
|
||
if __name__ == '__main__': | ||
print(f'MDX __main__: {sys.argv}') | ||
if len(sys.argv) <= 1: | ||
killer = GracefulKiller() | ||
print('MDX Task is running...') | ||
while not killer.kill_now: | ||
time.sleep(1) | ||
else: | ||
print('MDX calling main...') | ||
main(json.loads(sys.argv[1]), {}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters