Example #1
0
 def execute(self, job_details_tuple, **kwargs):
     job_details, path, job_count = job_details_tuple
     cassandra_driver = CassandraStorageDriver()
     cassandra_driver.connect(conf['cassandra']['keyspace'])
     cassandra_driver.insert_job_details(path=path,
                                         job_count=job_count,
                                         job_details=json.dumps(job_details))
     cassandra_driver.close_connection()
Example #2
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)
Example #3
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)
Example #4
0
 def _init_database_connections(self):
     db_driver = CassandraStorageDriver()
     db_driver.connect(conf['cassandra']['keyspace'])
     canary.database = db_driver
Example #5
0
 def _init_database_connections(self):
     db_driver = CassandraStorageDriver()
     db_driver.connect(conf['cassandra']['keyspace'])
     canary.database = db_driver