diff --git a/pikatasks/__init__.py b/pikatasks/__init__.py index f55ef53aeb2c001610ac10b91aa434109142f0c7..0c865266e19f79abe60f8b5c9dc9bf7993de4ebe 100644 --- a/pikatasks/__init__.py +++ b/pikatasks/__init__.py @@ -31,10 +31,10 @@ class RPCMessageQueueError(RPCError): all_tasks = set() # each registered task will show up here -def run(name, **kwargs): +def run(_task_name, **kwargs): """ Runs a task remotely. - :param name: name of the task to run + :param _task_name: name of the task to run :param kwargs: kwargs for the task :return: None """ @@ -44,7 +44,7 @@ def run(name, **kwargs): channel.confirm_delivery() channel.basic_publish( exchange=settings.CLIENT_EXCHANGE_NAME, - routing_key=name, + routing_key=_task_name, body=utils.serialize(kwargs), properties=pika.BasicProperties() ) @@ -52,11 +52,11 @@ def run(name, **kwargs): raise RPCMessageQueueError(e) -def rpc(name, **kwargs): +def rpc(_task_name, **kwargs): """ Runs a task remotely and returns its result. Raises RPCError if there were problems. - :param name: name of the task to run + :param _task_name: name of the task to run :param kwargs: kwargs for the task :return: whatever the task returned """ @@ -80,7 +80,7 @@ def rpc(name, **kwargs): """ run by pika simple timer """ nonlocal exception channel.stop_consuming() - exception = RPCTimedOut("RPC timed out. Task: {t}. Channel: {c}".format(t=name, c=channel)) + exception = RPCTimedOut("RPC timed out. Task: {t}. Channel: {c}".format(t=_task_name, c=channel)) try: with utils.get_connection() as conn: @@ -91,7 +91,7 @@ def rpc(name, **kwargs): # send a request channel.basic_publish( exchange=settings.CLIENT_EXCHANGE_NAME, - routing_key=name, + routing_key=_task_name, body=utils.serialize(kwargs), properties=pika.BasicProperties( reply_to="amq.rabbitmq.reply-to",