Esempio n. 1
0
def getlastjob(site):
    ses = makelogsession()()
    job = ses.query(Job).filter(
        Job.site == site.id).order_by('-end_date').first()
    if not job:
        return None
    return job.end_date
Esempio n. 2
0
def listsites():
    session = makelogsession()()
    sites = session.query(Site).all()

    if not sites:
        logger.error('No sites found, exiting')
        return None
    return sites
Esempio n. 3
0
def listsites():
    session = makelogsession()()
    sites = session.query(Site).all()
    
    if not sites:
        logger.error('No sites found, exiting')
        return None
    return sites
Esempio n. 4
0
                         (site.name, name))
            return None
    except Exception, e:
        logger.error('Could not create worker for  %s error was "%s"' %
                     (site.name, pprint(getPyroTraceback(e))))
        return None

    try:
        status, mesg = js.start(name)
    except Exception, e:
        logger.error('Could not start worker  %s error was "%s"' %
                     (name, getPyroTraceback(e)))
        return None

    try:
        sess = makelogsession()()
        job = Job(name=name, status='running')
        job.not_before = site.not_before
        job.not_after = site.not_after

        job.site = site.id
        #sess.save(job)
        sess.add(job)
        sess.commit()
        logger.info('Created job %s for site %s' % (name, site.name))
        return True
    except:
        logger.error('Could not save job information for %s error was %s' %
                     (site.name, traceback.format_exc()))
        return None
Esempio n. 5
0
def getlastjob(site):
    ses = makelogsession()()
    job = ses.query(Job).filter(Job.site==site.id).order_by('-end_date').first()
    if not job:
        return None
    return job.end_date
Esempio n. 6
0
            logger.error('Could not create worker for %s error was "%s"' % (site.name, name))
            return None
    except Exception, e:
        logger.error('Could not create worker for  %s error was "%s"' %
                     (site.name, pprint(getPyroTraceback(e))))
        return None
    
    try:
        status, mesg = js.start(name)
    except Exception, e:
        logger.error('Could not start worker  %s error was "%s"' % (name, getPyroTraceback(e)))
        return None
     

    try:
        sess = makelogsession()()
        job = Job(name=name, status='running')
        job.not_before = site.not_before
        job.not_after = site.not_after

        job.site = site.id
        #sess.save(job)
        sess.add(job)
        sess.commit()
        logger.info('Created job %s for site %s' % (name, site.name))
        return True
    except:
        logger.error('Could not save job information for %s error was %s' % (site.name,
                                                                   traceback.format_exc()))
        return None