예제 #1
0
def init(*args, **kwargs):
    progress = CheckProgress()
    bkr = Beaker()

    cfg_running = kwargs["running"]
    cfg_init = kwargs["init"]
    cfg_minid = kwargs["minid"]
    cfg_date = kwargs["date"]
    cfg_quiet = kwargs["quiet"]

    if cfg_date:
        cfg_date = datetime.strptime(kwargs["date"], "%Y-%m-%d")

    if kwargs["jobs"]:
        jobslist = kwargs["jobs"].split(" ")
    elif cfg_init:
        bkr_filter = {"owner": settings.BEAKER_OWNER}
        if cfg_minid:
            bkr_filter["minid"] = kwargs["minid"]
        else:
            # find job from previous init (date) - checked only new jobs
            # datetime.today().date()
            minid = Job.objects.values("uid").filter(
                date__lt=(currentDate() -
                          timedelta(days=2))).order_by("-uid")[:1]
            if minid:
                bkr_filter["minid"] = minid[0]["uid"][2:]
        jobslist = bkr.listJobs(bkr_filter)
    else:
        jobslist = [
            it["uid"]
            for it in Job.objects.values("uid").filter(is_finished=False)
        ]

    progress.totalsum = len(jobslist)
    progress.save()
    for it in jobslist:
        if not cfg_quiet:
            logger.info("%d/%d (%s)" %
                        (progress.actual, progress.totalsum, it))

        bkr.parse_job(it, running=cfg_running, date_created=cfg_date)
        progress.counter()
    progress.finished()
예제 #2
0
def init(*args, **kwargs):
    progress = CheckProgress()
    bkr = Beaker()

    cfg_running = kwargs["running"]
    cfg_init = kwargs["init"]
    cfg_minid = kwargs["minid"]
    cfg_date = kwargs["date"]
    cfg_quiet = kwargs["quiet"]

    if cfg_date:
        cfg_date = datetime.strptime(kwargs["date"], "%Y-%m-%d")

    if kwargs["jobs"]:
        jobslist = kwargs["jobs"].split(" ")
    elif cfg_init:
        bkr_filter = {"owner": settings.BEAKER_OWNER}
        if cfg_minid:
            bkr_filter["minid"] = kwargs["minid"]
        else:
            # find job from previous init (date) - checked only new jobs
            # datetime.today().date()
            minid = Job.objects.values("uid").filter(
                date__lt=(currentDate() - timedelta(days=2))).order_by("-uid")[:1]
            if minid:
                bkr_filter["minid"] = minid[0]["uid"][2:]
        jobslist = bkr.listJobs(bkr_filter)
    else:
        jobslist = [it["uid"]
                    for it in Job.objects.values("uid").filter(is_finished=False)]

    progress.totalsum = len(jobslist)
    progress.save()
    for it in jobslist:
        if not cfg_quiet:
            logger.info(
                "%d/%d (%s)" %
                (progress.actual, progress.totalsum, it))

        bkr.parse_job(it, running=cfg_running, date_created=cfg_date)
        progress.counter()
    progress.finished()
예제 #3
0
파일: models.py 프로젝트: alda519/GreenTea
 def finished(self):
     self.dateend = currentDate()
     self.save()
예제 #4
0
 def finished(self):
     self.dateend = currentDate()
     self.save()
예제 #5
0
파일: models.py 프로젝트: lhellebr/GreenTea
 def set_time(self, tdate=None):
     if not tdate:
         tdate = currentDate()
     self.created_date = tdate
     self.save()
예제 #6
0
 def set_time(self, tdate=None):
     if not tdate:
         tdate = currentDate()
     self.created_date = tdate
     self.save()