Пример #1
0
 def kill(self):
     ciel.log("Garbage collecting process %s" % self.id, "PROCESSPOOL", logging.INFO)
     write_fp = self.get_write_fifo()
     write_framed_json(("die", {"reason": "Garbage collected"}), write_fp)
     self.cleanup()
Пример #2
0
Файл: stub.py Проект: ms705/ciel
 # We're back -- either the user script is done, or else it's stuck waiting on a reference.
 if skypy.current_task.halt_reason == skypy.HALT_RUNTIME_EXCEPTION:
     report = "User script exception %s\n%s" % (str(skypy.current_task.script_return_val), skypy.current_task.script_backtrace)
     out_message = ("error", {"report": report})
 else:
     if skypy.current_task.halt_reason == skypy.HALT_REFERENCE_UNAVAILABLE:
         out_dict = {"executor_name": "skypy",
                     "extra_dependencies": [SW2_FutureReference(x) for x in skypy.current_task.persistent_state.ref_dependencies.keys()],
                     "is_fixed": skypy.current_task.persistent_state.is_fixed
                    }
         if not skypy.current_task.persistent_state.is_fixed:
             coro_ref = skypy.save_state(resume_state, make_local_sweetheart=True)
             soft_cache.put_cache([coro_ref], "coro", resume_state)
             out_dict.update({"pyfile_ref": skypy.current_task.persistent_state.py_ref,
                              "coro_ref": coro_ref})
         write_framed_json(("tail_spawn", out_dict), 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)
     if skypy.current_task.persistent_state.is_fixed:
         out_message = ("exit", {"keep_process": "must_keep"})
     else:
         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)
Пример #3
0
 def send_message(self, method, args):
     
     write_framed_json((method, args), self.out_fp)
     self.out_fp.flush()