30 lines
890 B
Python
30 lines
890 B
Python
"""Isolated complete S3+decode+publish effect, terminated by parent after 45 seconds."""
|
|
import os
|
|
import signal
|
|
import json
|
|
import sys
|
|
from uuid import UUID
|
|
from .jobs import process_objects_local
|
|
from .object_store import ObjectStore
|
|
|
|
|
|
def main():
|
|
# Survives SIGKILL of the supervising worker; kill the isolated effect group at deadline.
|
|
signal.signal(signal.SIGALRM,lambda *_:os.killpg(os.getpgrp(),signal.SIGKILL))
|
|
signal.alarm(45)
|
|
row=json.load(sys.stdin)
|
|
row['id']=UUID(row['id'])
|
|
store=ObjectStore()
|
|
try:
|
|
print(json.dumps(process_objects_local(store,row,sys.argv[1])))
|
|
except ValueError as exc:
|
|
sys.exit(66 if str(exc)=='processing_limit' else 65)
|
|
except Exception:
|
|
# Do not export credentials, storage keys or SDK response details.
|
|
sys.exit(75)
|
|
finally:
|
|
store.close()
|
|
|
|
|
|
if __name__=='__main__': main()
|