def _main():
arguments_json_path = sys.argv[1]
with open(arguments_json_path) as f:
arguments = pickle.loads(f.read())
# arguments_json_path is a temporary file created by the parent process.
# so we remove it here
os.remove(arguments_json_path)
task_id = arguments['task_id']
port = arguments['port']
messenger = _Messenger(task_id=task_id, port=port)
function = arguments['function']
operation_arguments = arguments['operation_arguments']
context_dict = arguments['context']
strict_loading = arguments['strict_loading']
try:
ctx = context_dict['context_cls'].instantiate_from_dict(**context_dict['context'])
except BaseException as e:
messenger.failed(e)
return
try:
messenger.started()
task_func = imports.load_attribute(function)
aria.install_aria_extensions(strict_loading)
for decorate in process_executor.decorate():
task_func = decorate(task_func)
task_func(ctx=ctx, **operation_arguments)
ctx.close()
messenger.succeeded()
except BaseException as e:
ctx.close()
messenger.failed(e)
评论列表
文章目录