예제 #1
0
 def load_from_uuid(self, task_uuid):
     backend = task_backend.get_backend()
     with contextlib.closing(backend.get_connection()) as conn:
         book = conn.get_logbook(task_uuid['book_id'])
         flow_detail = book.find(task_uuid['flow_id'])
     self._engine = engines.load_from_detail(flow_detail, backend=backend, engine='serial')
     self._book_uuid = book.uuid
     self.name += r' load exist uuid {} {}'.format(task_uuid['book_id'], task_uuid['flow_id'])
예제 #2
0
파일: base.py 프로젝트: TheSriram/taskflow
 def _engine_from_job(self, job):
     """Extracts an engine from a job (via some manner)."""
     flow_detail = self._flow_detail_from_job(job)
     if job.details and 'store' in job.details:
         store = dict(job.details["store"])
     else:
         store = {}
     return engines.load_from_detail(flow_detail, store=store,
                                     engine=self._engine,
                                     backend=self._persistence,
                                     **self._engine_options)
예제 #3
0
 def _engine_from_job(self, job):
     """Extracts an engine from a job (via some manner)."""
     flow_detail = self._flow_detail_from_job(job)
     if job.details and 'store' in job.details:
         store = dict(job.details["store"])
     else:
         store = {}
     return engines.load_from_detail(flow_detail,
                                     store=store,
                                     engine=self._engine,
                                     backend=self._persistence,
                                     **self._engine_options)
예제 #4
0
def _run_job(flow_detail, store, engine, persistence, engine_options):
    engine = engines.load_from_detail(flow_detail, store=store,
                                      engine=engine,
                                      backend=persistence,
                                      **engine_options)
    with logging_listener.LoggingListener(engine, log=LOG):
        LOG.debug("Dispatching engine for job")
        consume = True
        try:
            for stage_func, event_name in [(engine.compile, 'compilation'),
                                           (engine.prepare, 'preparation'),
                                           (engine.validate, 'validation'),
                                           (engine.run, 'running')]:
                # self._notifier.notify("%s_start" % event_name, {
                #     'job': job,
                #     'engine': engine,
                #     'conductor': self,
                # })
                stage_func()
                # self._notifier.notify("%s_end" % event_name, {
                #     'job': job,
                #     'engine': engine,
                #     'conductor': self,
                # })
        except excp.WrappedFailure as e:
            if all((f.check(*NO_CONSUME_EXCEPTIONS) for f in e)):
                consume = False
            if LOG.isEnabledFor(logging.WARNING):
                # if consume:
                #     LOG.warn("Job execution failed (consumption being"
                #              " skipped): %s [%s failures]", job, len(e))
                # else:
                #     LOG.warn("Job execution failed (consumption"
                #              " proceeding): %s [%s failures]", job, len(e))
                # Show the failure/s + traceback (if possible)...
                for i, f in enumerate(e):
                    LOG.warn("%s. %s", i + 1, f.pformat(traceback=True))
        except NO_CONSUME_EXCEPTIONS:
            # LOG.warn("Job execution failed (consumption being"
            #          " skipped): %s", job, exc_info=True)
            consume = False
        except Exception:
            # LOG.warn("Job execution failed (consumption proceeding): %s",
            #          job, exc_info=True)
            pass
        else:
            pass
            # LOG.info("Job completed successfully: %s", job)
        return consume
예제 #5
0
    def _engine_from_job(self, job):
        """Extracts an engine from a job (via some manner)."""
        flow_detail = self._flow_detail_from_job(job)
        store = {}

        if flow_detail.meta and 'store' in flow_detail.meta:
            store.update(flow_detail.meta['store'])

        if job.details and 'store' in job.details:
            store.update(job.details["store"])

        engine = engines.load_from_detail(flow_detail, store=store,
                                          engine=self._engine,
                                          backend=self._persistence,
                                          **self._engine_options)
        return engine
예제 #6
0
    def _engine_from_job(self, job):
        """Extracts an engine from a job (via some manner)."""
        flow_detail = self._flow_detail_from_job(job)
        store = {}

        if flow_detail.meta and 'store' in flow_detail.meta:
            store.update(flow_detail.meta['store'])

        if job.details and 'store' in job.details:
            store.update(job.details["store"])

        engine = engines.load_from_detail(flow_detail,
                                          store=store,
                                          engine=self._engine,
                                          backend=self._persistence,
                                          **self._engine_options)
        return engine
예제 #7
0
                book = conn.get_logbook(book_id)
                flow_detail = book.find(flow_id)
            except exc.NotFound:
                pass
    if book is None and flow_detail is None:
        book = p_utils.temporary_log_book(backend)
        engine = engines.load_from_factory(create_flow,
                                           backend=backend, book=book,
                                           engine='parallel',
                                           executor=executor)
        print("!! Your tracking id is: '%s+%s'" % (book.uuid,
                                                   engine.storage.flow_uuid))
        print("!! Please submit this on later runs for tracking purposes")
    else:
        # Attempt to load from a previously partially completed flow.
        engine = engines.load_from_detail(flow_detail, backend=backend,
                                          engine='parallel', executor=executor)

    # Make me my vm please!
    eu.print_wrapped('Running')
    engine.run()

# How to use.
#
# 1. $ python me.py "sqlite:////tmp/nova.db"
# 2. ctrl-c before this finishes
# 3. Find the tracking id (search for 'Your tracking id is')
# 4. $ python me.py "sqlite:////tmp/cinder.db" "$tracking_id"
# 5. Watch it pick up where it left off.
# 6. Profit!
예제 #8
0
        try:
            book = conn.get_logbook(book_id)
            flow_detail = book.find(flow_id)
        except exc.NotFound:
            pass
if book is None and flow_detail is None:
    book = p_utils.temporary_log_book(backend)
    engine = engines.load_from_factory(create_flow,
                                       backend=backend, book=book,
                                       engine_conf=engine_conf)
    print("!! Your tracking id is: '%s+%s'" % (book.uuid,
                                               engine.storage.flow_uuid))
    print("!! Please submit this on later runs for tracking purposes")
else:
    # Attempt to load from a previously potentially partially completed flow.
    engine = engines.load_from_detail(flow_detail,
                                      backend=backend, engine_conf=engine_conf)

# Make me my vm please!
print_wrapped('Running')
engine.run()

# How to use.
#
# 1. $ python me.py "sqlite:////tmp/nova.db"
# 2. ctrl-c before this finishes
# 3. Find the tracking id (search for 'Your tracking id is')
# 4. $ python me.py "sqlite:////tmp/cinder.db" "$tracking_id"
# 5. Watch it pick up where it left off.
# 6. Profit!
예제 #9
0
            flow_detail = book.find(flow_id)
        except exc.NotFound:
            pass
if book is None and flow_detail is None:
    book = p_utils.temporary_log_book(backend)
    engine = engines.load_from_factory(create_flow,
                                       backend=backend,
                                       book=book,
                                       engine_conf=engine_conf)
    print("!! Your tracking id is: '%s+%s'" %
          (book.uuid, engine.storage.flow_uuid))
    print("!! Please submit this on later runs for tracking purposes")
else:
    # Attempt to load from a previously potentially partially completed flow.
    engine = engines.load_from_detail(flow_detail,
                                      backend=backend,
                                      engine_conf=engine_conf)

# Make me my vm please!
print_wrapped('Running')
engine.run()

# How to use.
#
# 1. $ python me.py "sqlite:////tmp/nova.db"
# 2. ctrl-c before this finishes
# 3. Find the tracking id (search for 'Your tracking id is')
# 4. $ python me.py "sqlite:////tmp/cinder.db" "$tracking_id"
# 5. Watch it pick up where it left off.
# 6. Profit!
예제 #10
0
            except exc.NotFound:
                pass
    if book is None and flow_detail is None:
        book = p_utils.temporary_log_book(backend)
        engine = engines.load_from_factory(create_flow,
                                           backend=backend,
                                           book=book,
                                           engine='parallel',
                                           executor=executor)
        print("!! Your tracking id is: '%s+%s'" %
              (book.uuid, engine.storage.flow_uuid))
        print("!! Please submit this on later runs for tracking purposes")
    else:
        # Attempt to load from a previously partially completed flow.
        engine = engines.load_from_detail(flow_detail,
                                          backend=backend,
                                          engine='parallel',
                                          executor=executor)

    # Make me my vm please!
    eu.print_wrapped('Running')
    engine.run()

# How to use.
#
# 1. $ python me.py "sqlite:////tmp/nova.db"
# 2. ctrl-c before this finishes
# 3. Find the tracking id (search for 'Your tracking id is')
# 4. $ python me.py "sqlite:////tmp/cinder.db" "$tracking_id"
# 5. Watch it pick up where it left off.
# 6. Profit!