def __init__(self, new_batch, consume_incoming, consume_scoring, no_batches, enable_strategy_worker,
                 new_batch_delay, no_incoming):
        self.new_batch = CallLaterOnce(new_batch)
        self.new_batch.setErrback(self.error)

        self.consumption = CallLaterOnce(consume_incoming)
        self.consumption.setErrback(self.error)

        self.scheduling = CallLaterOnce(self.schedule)
        self.scheduling.setErrback(self.error)

        self.scoring_consumption = CallLaterOnce(consume_scoring)
        self.scoring_consumption.setErrback(self.error)

        self.disable_new_batches = no_batches
        self.disable_scoring_consumption = not enable_strategy_worker
        self.disable_incoming = no_incoming
        self.new_batch_delay = new_batch_delay
Beispiel #2
0
    def __init__(self, new_batch, consume_incoming, consume_scoring, no_batches, no_scoring, new_batch_delay, no_incoming):
        self.new_batch = CallLaterOnce(new_batch)
        self.new_batch.setErrback(self.error)

        self.consumption = CallLaterOnce(consume_incoming)
        self.consumption.setErrback(self.error)

        self.scheduling = CallLaterOnce(self.schedule)
        self.scheduling.setErrback(self.error)

        self.scoring_consumption = CallLaterOnce(consume_scoring)
        self.scoring_consumption.setErrback(self.error)

        self.is_finishing = False
        self.disable_new_batches = no_batches
        self.disable_scoring_consumption = no_scoring
        self.disable_incoming = no_incoming
        self.new_batch_delay = new_batch_delay
Beispiel #3
0
    def __init__(self, new_batch, consume_incoming, consume_scoring,
                 no_batches, enable_strategy_worker, new_batch_delay,
                 no_incoming):
        self.new_batch = CallLaterOnce(new_batch)
        self.new_batch.setErrback(self.error)

        self.consumption = CallLaterOnce(consume_incoming)
        self.consumption.setErrback(self.error)

        self.scheduling = CallLaterOnce(self.schedule)
        self.scheduling.setErrback(self.error)

        self.scoring_consumption = CallLaterOnce(consume_scoring)
        self.scoring_consumption.setErrback(self.error)

        self.disable_new_batches = no_batches
        self.disable_scoring_consumption = not enable_strategy_worker
        self.disable_incoming = no_incoming
        self.new_batch_delay = new_batch_delay
Beispiel #4
0
    def __init__(self, new_batch, consume_incoming, consume_scoring,
                 no_batches, no_scoring, new_batch_delay, no_incoming):
        self.new_batch = CallLaterOnce(new_batch)
        self.new_batch.setErrback(self.error)

        self.consumption = CallLaterOnce(consume_incoming)
        self.consumption.setErrback(self.error)

        self.scheduling = CallLaterOnce(self.schedule)
        self.scheduling.setErrback(self.error)

        self.scoring_consumption = CallLaterOnce(consume_scoring)
        self.scoring_consumption.setErrback(self.error)

        self.is_finishing = False
        self.disable_new_batches = no_batches
        self.disable_scoring_consumption = no_scoring
        self.disable_incoming = no_incoming
        self.new_batch_delay = new_batch_delay
Beispiel #5
0
class Slot(object):
    def __init__(self, new_batch, consume_incoming, consume_scoring,
                 no_batches, enable_strategy_worker, new_batch_delay,
                 no_incoming):
        self.new_batch = CallLaterOnce(new_batch)
        self.new_batch.setErrback(self.error)

        self.consumption = CallLaterOnce(consume_incoming)
        self.consumption.setErrback(self.error)

        self.scheduling = CallLaterOnce(self.schedule)
        self.scheduling.setErrback(self.error)

        self.scoring_consumption = CallLaterOnce(consume_scoring)
        self.scoring_consumption.setErrback(self.error)

        self.disable_new_batches = no_batches
        self.disable_scoring_consumption = not enable_strategy_worker
        self.disable_incoming = no_incoming
        self.new_batch_delay = new_batch_delay

    def error(self, f):
        logger.error(f)
        return f

    def schedule(self, on_start=False):
        if on_start and not self.disable_new_batches:
            self.new_batch.schedule(0)

        if not self.disable_incoming:
            self.consumption.schedule()
        if not self.disable_new_batches:
            self.new_batch.schedule(self.new_batch_delay)
        if not self.disable_scoring_consumption:
            self.scoring_consumption.schedule()
        self.scheduling.schedule(5.0)
class Slot(object):
    def __init__(self, new_batch, consume_incoming, consume_scoring, no_batches, enable_strategy_worker,
                 new_batch_delay, no_incoming):
        self.new_batch = CallLaterOnce(new_batch)
        self.new_batch.setErrback(self.error)

        self.consumption = CallLaterOnce(consume_incoming)
        self.consumption.setErrback(self.error)

        self.scheduling = CallLaterOnce(self.schedule)
        self.scheduling.setErrback(self.error)

        self.scoring_consumption = CallLaterOnce(consume_scoring)
        self.scoring_consumption.setErrback(self.error)

        self.disable_new_batches = no_batches
        self.disable_scoring_consumption = not enable_strategy_worker
        self.disable_incoming = no_incoming
        self.new_batch_delay = new_batch_delay

    def error(self, f):
        logger.error(f)
        return f

    def schedule(self, on_start=False):
        if on_start and not self.disable_new_batches:
            self.new_batch.schedule(0)

        if not self.disable_incoming:
            self.consumption.schedule()
        if not self.disable_new_batches:
            self.new_batch.schedule(self.new_batch_delay)
        if not self.disable_scoring_consumption:
            self.scoring_consumption.schedule()
        self.scheduling.schedule(5.0)