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)
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)
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)
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)
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)
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)
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)