From 04ec59eec441fe4ab070884df7e37ca23dbd4506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Rodr=C3=ADguez=20Flores?= Date: Tue, 16 Jan 2024 14:27:29 +0000 Subject: [PATCH] Removed trailing whitespaces. --- resources/src/druid/client.py | 2 +- resources/src/druid/query_builder.py | 15 +++++++-------- resources/src/redborder/async_jobs/train_job.py | 2 +- resources/src/redborder/rq.py | 5 ++--- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/resources/src/druid/client.py b/resources/src/druid/client.py index 024bce0..bb2152d 100644 --- a/resources/src/druid/client.py +++ b/resources/src/druid/client.py @@ -40,7 +40,7 @@ def execute_query(self, druid_query): Returns: dict: The response from the Druid query in JSON format. - + Raises: Exception: If the Druid query fails with a non-200 status code. """ diff --git a/resources/src/druid/query_builder.py b/resources/src/druid/query_builder.py index b1114b7..6471fdc 100644 --- a/resources/src/druid/query_builder.py +++ b/resources/src/druid/query_builder.py @@ -33,7 +33,7 @@ class QueryBuilder: def __init__(self, aggregations, post_aggregations): """ Initializer of the class - + Args: aggregations (string): path to json file with the 'aggregations' value of the druid query. @@ -84,9 +84,9 @@ def modify_aggregations(self, query): """ Modify a druid query to add every field the traffic module uses. Those are: "bytes", "pkts", "clients", "flows", "bps", "pps", "fps", - "bytes_per_client" , "bytes_per_sec_per_client", "flows_per_client" + "bytes_per_client" , "bytes_per_sec_per_client", "flows_per_client" and "flows_per_sec_per_client". - + Args: -query (dict): dicitionary with the druid query. Returns: @@ -104,7 +104,7 @@ def modify_aggregations(self, query): def modify_granularity(self, query, gran): """ Modify the granularity of a druid query. - + Args: -query (dict): dicitionary with the druid query. -granularity (string): druid granularity. @@ -118,7 +118,7 @@ def modify_granularity(self, query, gran): def modify_filter(self, query, filter_druid): """ Modify a druid query to add a filter of the traffic module. - + Args: -query (dict): dicitionary with the serialized druid query. -filter_druid (dict): dictionary with the serialized filter. @@ -132,7 +132,7 @@ def modify_filter(self, query, filter_druid): def set_time_origin(self, query, time): """ Modify a druid query to change time origin - + Args: -query: dictionary with the druid query. Returns: @@ -145,7 +145,7 @@ def set_time_origin(self, query, time): def set_time_interval(self, query, time_start, time_end): """ Modify a druid query to change time interval - + Args: -query: dictionary with the druid query. -time_start: the start time of the data to retrieve. @@ -158,4 +158,3 @@ def set_time_interval(self, query, time_start, time_end): f"{time_start}/{time_end}" ] return new_query - diff --git a/resources/src/redborder/async_jobs/train_job.py b/resources/src/redborder/async_jobs/train_job.py index 780a582..cb29dfa 100644 --- a/resources/src/redborder/async_jobs/train_job.py +++ b/resources/src/redborder/async_jobs/train_job.py @@ -108,7 +108,7 @@ def get_model_filter(self, model_name): Args: model_name (str): The identifier of the model. - + Returns: (dict): Dictionary with the filter of the model. """ diff --git a/resources/src/redborder/rq.py b/resources/src/redborder/rq.py index 3f0e2df..5294776 100644 --- a/resources/src/redborder/rq.py +++ b/resources/src/redborder/rq.py @@ -68,7 +68,7 @@ def fetch_redis_secret(self): str: redis secret """ return config.get("Redis", "rd_secret") - + def fetch_model_names(self): """ Fetch model names from the config file @@ -76,7 +76,7 @@ def fetch_model_names(self): str: model names """ return config.get("Outliers", "model_names") - + def cron_to_rq_datetime(self, cron_expression): """ Convert a cron expression to a valid datetime object for the next scheduled time. @@ -120,4 +120,3 @@ def schedule_train_job(self): logger.info("Waiting for re-queue...") time.sleep(delay) self.schedule_train_job() -