Function call not working even though proper arguments are passed

42 views Asked by At

let's say I have 2 files - file1 and file 2 - File 2 has a celery method -

@async_worker.task(ignore_result=True, queue="data_path")
def publish_msg_from_lock_async(mac: str, data: bytes, gateway_euid: str, req_id=None):
    try:
        vostio_log.info("here - ", extra=_log_token_dict)
        addr = mac
        payload = data
        vostio_log.info("addr {} - payload {} ".format(addr, payload), extra=_log_token_dict)
        device_id = VOSTIO_CLIENT_ID
        cert = VOSTIO_CERT_CRT
        key = VOSTIO_CERT_KEY
        ca = VOSTIO_CERT_CA
        host = VOSTIO_URL
        port = int(VOSTIO_PORT)

        from .sdk import VostioSDK
        n = VostioSDK(device_id, cert, key, ca, host, port)
        n.publish_msg_from_lock(addr, unhexlify(payload), gateway_euid)
    except Exception as e:
        return False

This is being called in file1 like this -

publish_msg_from_lock_async.apply_async(args=(addr, payload, gateway_euid))

publish_msg_from_lock method is also defined in file1 like this -

    def publish_msg_from_lock(self, mac: str, data: bytes, gateway_euid: str):
        vostio_log.info("Publishing message from lock ", extra=_log_token_dict)
        payload = json.dumps([{
            'id': f'{uuid.uuid4()}',
            'addr': mac,
            'data': b64encode(data).decode(),
        }])
        topic = f'net/{self.id}/gw/{gateway_euid}/lock/up'
        self._publish(topic, payload)

So if you see, file2 method has a log in starting of it, which is not coming, so the invoking is not happening.

Can you please help.

0

There are 0 answers