コード例 #1
0
ファイル: mongodriver.py プロジェクト: mkmad/canary
    def insert_job_details(self, path, job_details, job_count):
        collection = self.session[conf.mongo.collection]

        date = canonicalize(time.time())
        args = dict(date=date,
                    path=path,
                    job_count=job_count,
                    jobs=job_details)
        collection.insert_one(args)
コード例 #2
0
ファイル: mongodriver.py プロジェクト: BryanSD/canary
    def insert_job_details(self, path, job_details, job_count):
        collection = self.session[conf.mongo.collection]

        date = canonicalize(time.time())
        args = dict(
            date=date,
            path=path,
            job_count=job_count,
            jobs=job_details
        )
        collection.insert_one(args)
コード例 #3
0
ファイル: cassandradriver.py プロジェクト: mkmad/canary
    def insert_job_details(self, path, job_details, job_count):
        stmt = query.SimpleStatement(CQL_STORE_JOB_DETAILS,
                                     consistency_level=self.consistency_level)
        date = canonicalize(time.time())
        args = dict(
            date=date,
            path=path,
            job_count=job_count,
            jobs=json.dumps(job_details)

        )
        self.session.execute(stmt, args)
コード例 #4
0
    def insert_job_details(self, path, job_details, job_count):
        query = self.simplestatement(CQL_STORE_JOB_DETAILS,
                                     consistency_level=self.consistency_level)
        date = canonicalize(time.time())
        args = dict(
            date=date,
            path=path,
            job_count=job_count,
            jobs=job_details

        )
        self.session.execute(query, args)
コード例 #5
0
ファイル: jobs.py プロジェクト: BryanSD/canary
    def on_get(self, req, resp):
        path = req.get_param('path')
        if not path:
            description = "Specify a valid `path` querystring"
            raise HTTPBadRequest(title="Bad Request",
                                 description=description)
        cassandra_driver = CassandraStorageDriver()
        cassandra_driver.connect(conf['cassandra']['keyspace'])
        current_time = time.time()
        query_time = current_time - conf['canary']['interval']
        job_details = \
            cassandra_driver.get_job_details(date=canonicalize(query_time),
                                             path=path)
        cassandra_driver.close_connection()
        resp.status = falcon.HTTP_200

        for i in range(len(job_details)):
            job_details[i]['jobs'] = json.loads(json.loads(job_details[i]['jobs']))
        resp.body = json.dumps(job_details)
コード例 #6
0
    def on_get(self, req, resp):
        path = req.get_param('path')
        if not path:
            description = "Specify a valid `path` querystring"
            raise HTTPBadRequest(title="Bad Request", description=description)
        cassandra_driver = CassandraStorageDriver()
        cassandra_driver.connect(conf['cassandra']['keyspace'])
        current_time = time.time()
        query_time = current_time - conf['canary']['interval']
        job_details = \
            cassandra_driver.get_job_details(date=canonicalize(query_time),
                                             path=path)
        cassandra_driver.close_connection()
        resp.status = falcon.HTTP_200

        for i in range(len(job_details)):
            job_details[i]['jobs'] = json.loads(
                json.loads(job_details[i]['jobs']))
        resp.body = json.dumps(job_details)
コード例 #7
0
ファイル: cassandradriver.py プロジェクト: mmadhavan/canary
 def insert_job_details(self, path, job_details, job_count):
     stmt = query.SimpleStatement(CQL_STORE_JOB_DETAILS, consistency_level=self.consistency_level)
     date = canonicalize(time.time())
     args = dict(date=date, path=path, job_count=job_count, jobs=json.dumps(job_details))
     self.session.execute(stmt, args)