Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def wait(self, **kwargs):
out_dict = {"id": self.ref.id}
out_dict.update(kwargs)
runtime_response = skypy.current_task.message_helper.synchronous_request("wait_stream", out_dict)
if not runtime_response["success"]:
raise Exception("File transfer failed before EOF")
else:
self.really_eof = runtime_response["done"]
self.current_size = runtime_response["size"]
}
)
write_framed_json(out_message, write_fp)
elif skypy.current_task.halt_reason == skypy.HALT_DONE:
out_fp = MaybeFile(open_callback=lambda: skypy.open_output(0))
with out_fp:
if skypy.current_task.persistent_state.export_json:
simplejson.dump(skypy.current_task.script_return_val, out_fp)
else:
pickle.dump(skypy.current_task.script_return_val, out_fp)
skypy.ref_from_maybe_file(out_fp, 0)
out_message = ("exit", {"keep_process": "may_keep", "soft_cache_keys": soft_cache.get_cache_keys()})
write_framed_json(out_message, write_fp)
if skypy.current_task.halt_reason == skypy.HALT_RUNTIME_EXCEPTION:
sys.exit(0)
skypy.current_task = None
except ShutdownException, e:
print >>sys.stderr, "SkyPy: killed by Ciel (reason: '%s')" % e.reason
sys.exit(0)
except Exception, e:
print >>sys.stderr, "SkyPy: exception reached top level!"
report = "Top-level exception %s\n%s" % (repr(e), traceback.format_exc())
out_message = ("error", {"report": report})
write_framed_json(out_message, write_fp)
sys.exit(1)