コード例 #1
0
ファイル: webserver.py プロジェクト: ghmhust/leetcode_py
    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
ファイル: webserver.py プロジェクト: JesseLu/maxwell-server
    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
ファイル: simserver.py プロジェクト: JesseLu/maxwell-server
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
ファイル: simserver.py プロジェクト: rickyim/maxwell-b
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
ファイル: simserver.py プロジェクト: ghmhust/leetcode_py
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')