From 670d91155604bb1d5121accad6367f7714d8d68a Mon Sep 17 00:00:00 2001 From: ddamiron <ddamiron@sii.fr> Date: Tue, 2 Jul 2019 13:11:48 +0200 Subject: [PATCH] add progress_ratio tag in log_message --- main.py | 12 ++++++++---- workers/doc-processor.py | 2 +- workers/metadata-processor.py | 2 +- workers/reindexer.py | 21 ++++++++++++++------- workers/sample-generator.py | 15 ++++++++++----- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/main.py b/main.py index f60ffe0..096edf5 100644 --- a/main.py +++ b/main.py @@ -186,7 +186,8 @@ def delete_dataset_from_dest_index(the_rabbit, the_cfg, the_uuid): status='delete_dataset_from_dest_index', uuid_prefix='meta', info='no info', - loglevel='INFO' + loglevel='INFO', + progress_ratio=0.2 ) the_rabbit.publish_log(log_message=log_message.__dict__) # ------------------------------------------------------------ @@ -279,7 +280,8 @@ def main(cfg): status='Starting...', uuid_prefix='meta', info='no info', - loglevel='INFO' + loglevel='INFO', + progress_ratio=0 ) cfg['session']['current_uuid'] = uuid_to_get with RabbitSession(cfg) as rabbit: @@ -302,7 +304,8 @@ def main(cfg): status='Terminated', uuid_prefix='meta', info='no info', - loglevel='INFO' + loglevel='INFO', + progress_ratio=1 ) cfg['session']['current_uuid'] = uuid_to_get rabbit.publish_log(log_message=log_message2.__dict__) @@ -315,7 +318,8 @@ def main(cfg): status='this message is for testing only', uuid_prefix='meta', info='no info', - loglevel='ERROR' + loglevel='ERROR', + progress_ratio=None ) cfg['session']['current_uuid'] = uuid_to_get rabbit.publish_log(log_message=log_message2.__dict__) diff --git a/workers/doc-processor.py b/workers/doc-processor.py index b1b9f3d..d1e9527 100644 --- a/workers/doc-processor.py +++ b/workers/doc-processor.py @@ -181,7 +181,7 @@ def process_docs( channel, method, properties, body ): properties=pika.BasicProperties(delivery_mode=2) ) # ------------------------------------------------------------ - channel.basic_ack(delivery_tag = method.delivery_tag) + channel.basic_ack(delivery_tag=method.delivery_tag) return diff --git a/workers/metadata-processor.py b/workers/metadata-processor.py index 03cc81f..a83a40c 100644 --- a/workers/metadata-processor.py +++ b/workers/metadata-processor.py @@ -441,7 +441,7 @@ def callback( channel, method, properties, body ): uuid_prefix='meta', info='no info', loglevel='INFO', - progress_ratio=50 + progress_ratio=0.5 ) json_body = json.dumps(log_message.__dict__) diff --git a/workers/reindexer.py b/workers/reindexer.py index a2681e2..69d83e3 100644 --- a/workers/reindexer.py +++ b/workers/reindexer.py @@ -41,7 +41,8 @@ def create_sampling_task(cfg, channel, uuid): status='create sampling task', uuid_prefix='full', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=0.2 ) json_body = json.dumps(log_message.__dict__) @@ -160,7 +161,8 @@ def on_msg_callback(channel, method, properties, body): status=message, uuid_prefix='full', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=0.3 ) json_body = json.dumps(log_message.__dict__) @@ -191,7 +193,8 @@ def on_msg_callback(channel, method, properties, body): status=message, uuid_prefix='full', info=uuid, - loglevel='ERROR' + loglevel='ERROR', + progress_ratio=None ) json_body = json.dumps(log_message.__dict__) @@ -230,7 +233,8 @@ def on_msg_callback(channel, method, properties, body): status=exc, uuid_prefix='full', info=uuid, - loglevel='ERROR' + loglevel='ERROR', + progress_ratio=None ) json_body = json.dumps(log_message.__dict__) @@ -302,7 +306,8 @@ def on_msg_callback(channel, method, properties, body): status=message, uuid_prefix='full', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=None ) json_body = json.dumps(log_message.__dict__) @@ -329,7 +334,8 @@ def on_msg_callback(channel, method, properties, body): status=message, uuid_prefix='meta', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=1 ) json_body = json.dumps(log_message.__dict__) @@ -360,7 +366,8 @@ def on_msg_callback(channel, method, properties, body): status=message, uuid_prefix='', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=1 ) json_body = json.dumps(log_message.__dict__) diff --git a/workers/sample-generator.py b/workers/sample-generator.py index 34d086b..07810a1 100644 --- a/workers/sample-generator.py +++ b/workers/sample-generator.py @@ -189,7 +189,8 @@ def callback(channel, method, properties, body): status=message, uuid_prefix='', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=None ) json_body = json.dumps(log_message.__dict__) @@ -222,7 +223,8 @@ def callback(channel, method, properties, body): status=exc, uuid_prefix='full', info=uuid, - loglevel='ERROR' + loglevel='ERROR', + progress_ratio=None ) json_body = json.dumps(log_message.__dict__) @@ -262,7 +264,8 @@ def callback(channel, method, properties, body): status=message, uuid_prefix='', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=None ) json_body = json.dumps(log_message.__dict__) @@ -298,7 +301,8 @@ def callback(channel, method, properties, body): status=rep, uuid_prefix='full', info=uuid, - loglevel='ERROR' + loglevel='ERROR', + progress_ratio=None ) json_body = json.dumps(log_message.__dict__) @@ -325,7 +329,8 @@ def callback(channel, method, properties, body): status=message, uuid_prefix='', info=uuid, - loglevel='INFO' + loglevel='INFO', + progress_ratio=1 ) json_body = json.dumps(log_message.__dict__) -- GitLab