Пример #1
0
    def run(self):
        self._scheduler = GenericScheduler(which)
        self._peak_scheduler = GenericScheduler(which, full_interval=self._file_configs.fp_interval)
        self._holiday_scheduler = GenericScheduler(which, full_interval=self._file_configs.fh_interval)

        self._scheduler.dispatch_task()
        self._peak_scheduler.dispatch_task()
        self._holiday_scheduler.dispatch_task()

        while 1:
            attemper = self.attemper

            if attemper == 0:
                msg = "workday at peak"
                job_count = self._peak_scheduler.jobs_count
                self._peak_scheduler.run_jobs()
            elif attemper == 1:
                msg = "workday at not peak"
                job_count = self._scheduler.jobs_count
                self._scheduler.run_jobs()
            else:
                msg = "holiday"
                job_count = self._holiday_scheduler.jobs_count
                self._holiday_scheduler.run_jobs()
            time.sleep(15)

            if self.minutes % 3 == 0:
                print(time.strftime("%Y-%m-%d %H:%M:%S %A")),
                print("Typ: [%s], job count: %s" % (msg, job_count))
                time.sleep(20)
Пример #2
0
class AmazonSGRun(FreqMinx):
    """
    Fetching in amazon's Singapore foreign news websites,
    Amazon's Beijing machine can't access to foreign websites
    """
    def __init__(self):
        self._scheduler = None
        self._holiday_scheduler = None

        super(AmazonSGRun, self).__init__()

    def run(self):
        self._scheduler = GenericScheduler(default)
        self._holiday_scheduler = GenericScheduler(default, full_interval=self._file_configs.fh_interval)

        self._scheduler.dispatch_task()
        self._holiday_scheduler.dispatch_task()

        while 1:
            attemper = self.attemper

            if attemper != 2:
                msg = 'at workday'
                job_count = self._scheduler.jobs_count
                self._scheduler.run_jobs()
            else:
                msg = 'at holiday'
                job_count = self._holiday_scheduler.jobs_count
                self._holiday_scheduler.run_jobs()
            time.sleep(15)

            if self.minutes % 3 == 0:
                print(time.strftime('%Y-%m-%d %H:%M:%S %A')),
                print('Typ: [%s], job count: %s' % (msg, job_count))
                time.sleep(20)
Пример #3
0
    def run(self):
        self._scheduler = GenericScheduler(default)
        self._holiday_scheduler = GenericScheduler(default, full_interval=self._file_configs.fh_interval)

        self._scheduler.dispatch_task()
        self._holiday_scheduler.dispatch_task()

        while 1:
            attemper = self.attemper

            if attemper != 2:
                msg = 'at workday'
                job_count = self._scheduler.jobs_count
                self._scheduler.run_jobs()
            else:
                msg = 'at holiday'
                job_count = self._holiday_scheduler.jobs_count
                self._holiday_scheduler.run_jobs()
            time.sleep(15)

            if self.minutes % 3 == 0:
                print(time.strftime('%Y-%m-%d %H:%M:%S %A')),
                print('Typ: [%s], job count: %s' % (msg, job_count))
                time.sleep(20)
Пример #4
0
class HotRun(FreqMinx):
    def __init__(self):
        self._scheduler = None
        self._peak_scheduler = None
        self._holiday_scheduler = None

        super(HotRun, self).__init__()

    def run(self):
        self._scheduler = GenericScheduler(which)
        self._peak_scheduler = GenericScheduler(which, hot_interval=self._file_configs.hp_interval)
        self._holiday_scheduler = GenericScheduler(which, hot_interval=self._file_configs.hh_interval)

        self._scheduler.dispatch_task()
        self._peak_scheduler.dispatch_task()
        self._holiday_scheduler.dispatch_task()

        while 1:
            attemper = self.attemper

            if attemper == 0:
                msg = 'workday at peak'
                job_count = self._peak_scheduler.jobs_count
                self._peak_scheduler.run_jobs()
            elif attemper == 1:
                msg = 'workday at not peak'
                job_count = self._scheduler.jobs_count
                self._scheduler.run_jobs()
            else:
                msg = 'holiday'
                job_count = self._holiday_scheduler.jobs_count
                self._holiday_scheduler.run_jobs()
            time.sleep(15)

            if self.minutes % 3 == 0:
                print(time.strftime('%Y-%m-%d %H:%M:%S %A')),
                print('Typ: [%s], job count: %s' % (msg, job_count))
                time.sleep(20)