Пример #1
0
    def do_HEAD(self):
        """ Returns the number of jobs in queue. """
        self.send_response(200)
        self.send_header('Content-type', 'maxwell!')
        self.end_headers()

        num_requests = len(maxwell_config.list_requests())
        shutil.copyfileobj(StringIO("%d jobs pending (maxwell-server)" \
                            % num_requests), self.wfile)
Пример #2
0
    def do_HEAD(self):
        """ Returns the number of jobs in queue. """
        self.send_response(200)
        self.send_header('Content-type', 'maxwell!')
        self.end_headers()

        num_requests = len(maxwell_config.list_requests())
        shutil.copyfileobj(StringIO("%d jobs pending (maxwell-server)" \
                            % num_requests), self.wfile)
Пример #3
0
def find_oldest_job():
    req = maxwell_config.list_requests() # Get the requests.
    if not req:
        return None

    req_with_time = {}
    for r in req:
        req_with_time[r] = os.stat(maxwell_config.path + r).st_ctime

    oldest_req = min(req_with_time) # Run this job.
    os.remove(maxwell_config.path + oldest_req)
    return oldest_req.rstrip('.request')
Пример #4
0
def find_oldest_job():
    req = maxwell_config.list_requests() # Get the requests.
    if not req:
        return None

    req_with_time = {}
    for r in req:
        req_with_time[r] = os.stat(os.path.join(maxwell_config.path, r)).st_ctime

    oldest_req = min(req_with_time) # Run this job.
    os.remove(os.path.join(maxwell_config.path, oldest_req))
    return oldest_req[:-len('.request')]
Пример #5
0
def find_oldest_job():
    req = maxwell_config.list_requests()  # Get the requests.
    if not req:
        return None

    req_with_time = {}
    for r in req:
        req_with_time[r] = os.stat(maxwell_config.path + r).st_ctime

    oldest_req = min(req_with_time)  # Run this job.
    os.remove(maxwell_config.path + oldest_req)
    return oldest_req.rstrip('.request')