예제 #1
0
    def _main_loop(self):
        logging.debug('+ Packet.run')

        while True:
            with self._lock:
                logging.debug('_before_job_start_loop')

                if not (self._do_not_run or self._cancelled):
                    logging.debug('_graph_executor.state == %s' \
                        % GraphState.str(self._graph_executor.state))

                    while self._graph_executor.state & GraphState.PENDING_JOBS:
                        self._start_one_another_job()

                logging.debug('_before_send_update_check: %s' % ((self._has_updates, self._finished),))
                if self._has_updates and not self._finished:
                    logging.debug('_before_send_update')
                    self._send_update()
                    self._has_updates = False

                if self._finished:
                    break

                logging.debug('_before_cond_wait')
                self._something_changed.wait()
                logging.debug('_after_cond_wait')

        logging.debug('+ exiting Packet.run')
예제 #2
0
    pck.join()
    logging.debug('after_pck_join')

    last_update_message = pck.produce_rem_update_message()

    if not notifier_failed[0]:
        rem_notifier.send_update(last_update_message, is_final=True)

    rem.delayed_executor.stop()
    rpc_server.shutdown()
    logging.debug('after_rpc_shutdown')

    rem_notifier.stop(1.0) # FIXME XXX TODO :)
    logging.debug('after_rem_notifier_stop')

    #if not pck.is_cancelled():
    if True:
        with open(opts.result_snapshot_file, 'w') as out:
            pickle.dump(pck, out, 2)

        with open(opts.last_update_message_file, 'w') as out:
            pickle.dump(last_update_message, out, 2)


        if opts.last_update_user_summary_file:
            with open(opts.last_update_user_summary_file, 'w') as out:
                print >>out, json.dumps({'status': GraphState.str(pck.state)}, indent=3)

    logging.debug('after_all')