code: def main(argv):
      del argv
      batch_size = None if BATCH_SIZE <= 0 else BATCH_SIZE
      num_assets = None if NUM_ASSETS <= 0 else NUM_ASSETS
      pricer = pricers.TffOptionPricer(
          batch_size=batch_size, num_assets=num_assets
      )
      context = zmq.Context()
      receiver = context.socket(zmq.PULL)
      channel = "ipc://" + path.join(IPC_PATH, IPC_NAME)
      receiver.connect(channel)
      logging.info("Pricer ready and listening at %s", channel)
  
      while True:
          logging.info("Waiting for inputs...")
          inputs: datatypes.ComputeRequest = receiver.recv_pyobj()
          print("Received input data...")
          with pricers.Timer() as read_timer:
              market_data = tff.experimental.io.ArrayDictReader(
                  inputs.market_data_path
              ).next()
              portfolio = tff.experimental.io.ArrayDictReader(
                  inputs.portfolio_path
              ).next()
          logging.info(
              "Read input data in %f ms", read_timer.elapsed_ms
          )
          with pricers.Timer() as compute_timer:
              prices = pricer.price(
                  market_data["spot"],
                  market_data["volatility"],
                  market_data["rate"],
                  portfolio["underlier_id"],
                  portfolio["strike"],
                  portfolio["call_put_flag"],
                  portfolio["expiry_date"],
              )
              results = {
                  "trade_id": portfolio["trade_id"],
                  "prices": prices,
              }
              output_path = path.join(
                  RESULTS_BASE_PATH,
                  "results_" + path.basename(inputs.portfolio_path),
              )
          logging.info(
              "Computed prices in %f ms", compute_timer.elapsed_ms
          )
          with pricers.Timer() as write_timer:
              with tff.experimental.io.ArrayDictWriter(
                  output_path
              ) as writer:
                  writer.write(results)
          logging.info(
              "Wrote output results to %s in %f ms",
              output_path,
              write_timer.elapsed_ms,
          )
  
          total_ms = (
              read_timer.elapsed_ms
              + compute_timer.elapsed_ms
              + write_timer.elapsed_ms
          )
          logging.info(
              "Processed request of size %d in %f total ms.",
              portfolio["underlier_id"].size,
              total_ms,
          )
  
file_path: tf-quant-finance/tf_quant_finance/examples/demos/option_pricing_basic/pricer/app/main.py
imports: import os
  from os import path
  from absl import app
  from absl import logging
  from common import datatypes
  import pricers
  import tf_quant_finance
  import zmq
label_desc: Use image node_id 1 for calling a global function with example usage: main(argv) without return types