Test Receive Addresses Script

Introduction

The purpose of this script is to test the mechanism for generating SDP receive addresses from the channel link map for each scan type in the execution block. The script picks it up from there, uses it to generate the receive addresses for each scan type and writes them to the processing block state. The addresses are published on the receiveAddresses attribute by the SDP subarray.

Full description of processing block parameters of this script can be found at the Processing block parameters section.

Testing

Deploy SDP and make sure the iTango console pod is also running.

After entering the iTango pod, obtain a handle to a subarray device and turn it on:

d = DeviceProxy('test-sdp/subarray/01')
d.On()

If you are not sure what devices are available, list them with lsdev. Here is the configuration string for the execution block:

config = '''
{
  "interface": "https://schema.skao.int/ska-sdp-assignres/0.4",
  "resources": {
    "receptors": ["SKA001", "SKA002", "SKA003", "SKA004"]
  },
  "execution_block": {
    "eb_id": "eb-test-20220916-00000",
    "context": {},
    "max_length": 3600.0,
    "beams": [
      {"beam_id": "vis0", "function": "visibilities"}
    ],
    "scan_types": [
      {
        "scan_type_id": ".default",
        "beams": {
          "vis0": {
            "channels_id": "vis_channels",
            "polarisations_id": "all"
          }
        }
      },
      {
        "scan_type_id": "target:a",
        "derive_from": ".default",
        "beams": {
          "vis0": {
            "field_id": "field_a"
          }
        }
      },
      {
        "scan_type_id": "calibration:b",
        "derive_from": ".default",
        "beams": {
          "vis0": {
            "field_id": "field_b"
          }
        }
      }
    ],
    "channels": [
      {
        "channels_id": "vis_channels",
        "spectral_windows": [
          {
            "spectral_window_id":"fsp_1_channels",
            "count":4,
            "start":0,
            "stride":2,
            "freq_min":350000000.0,
            "freq_max":368000000.0,
            "link_map":[[0, 0], [200, 1], [744, 2], [944, 3]]
          }
        ]
      }
    ],
    "polarisations": [
      {
        "polarisations_id": "all",
        "corr_type": ["XX", "XY", "YX", "YY"]
      }
    ],
    "fields": [
      {
        "field_id": "field_a",
        "phase_dir": {
          "ra": [123.0],
          "dec": [-60.0],
          "reference_frame": "ICRF3",
          "reference_time": "..."
        }
      },
      {
        "field_id": "field_b",
        "phase_dir": {
          "ra": [123.0],
          "dec": [-60.0],
          "reference_frame": "ICRF3",
          "reference_time": "..."
        }
      }
    ]
  },
  "processing_blocks": [
    {
      "pb_id": "pb-test-20220916-00000",
      "script": {"kind": "realtime", "name": "test-receive-addresses", "version": "0.5.0"},
      "sbi_ids": ["sbi-test-20220916-00000"],
      "parameters": {}
    }
  ]
}
'''

Note that each script may come in multiple versions. Always use the latest version, unless you know a specific version that suits your needs. (The Changelog at the end of this page may help you to decide.)

Start the execution block with the AssignResources command:

d.AssignResources(config)

You can connect to the configuration database by running the following command:

kubectl -n <namespace> exec -it ska-sdp-console-0 -- bash

and from there to see the full list of entries, run

ska-sdp list -a

To check if the receive addresses are updated in the processing block state correctly, run the following command:

ska-sdp get pb pb-test-20220916-00000/state

and the output should look like this:

/pb/pb-test-20220916-00000/state = {
  "deployments": {
    "proc-pb-test-20220916-00000-test-receive": "RUNNING"
  },
  "last_updated": "2022-09-16 15:34:27",
  "receive_addresses": {
    "calibration:b": {
      "vis0": {
        "function": "visibilities",
        "host": [
          [
            0,
            "proc-pb-test-20220916-00000-test-receive-0.receive.test-sdp.svc.cluster.local"
          ]
        ],
        "port": [
          [
            0,
            9000,
            1
          ]
        ]
      }
    },
    "target:a": {
      "vis0": {
        "function": "visibilities",
        "host": [
          [
            0,
            "proc-pb-test-20220916-00000-test-receive-0.receive.test-sdp.svc.cluster.local"
          ]
        ],
        "port": [
          [
            0,
            9000,
            1
          ]
        ]
      }
    }
  },
  "resources_available": true,
  "status": "READY"
}

This should now update the receiveAddresses attribute with receive addresses map and that can be verified by running d.receiveAddresses and the output should look like this:

Out[4]: '{"calibration:b": {"vis0": {"function": "visibilities", "host": [[0, "proc-pb-test-20220916-00000-test-receive-0.receive.test-sdp.svc.cluster.local"]], "port": [[0, 9000, 1]]}}, "target:a": {"vis0": {"function": "visibilities", "host": [[0, "proc-pb-test-20220916-00000-test-receive-0.receive.test-sdp.svc.cluster.local"]], "port": [[0, 9000, 1]]}}}'

Processing block parameters

pydantic settings TestReceiveAddressesParams

test-receive-addresses script parameters

Show JSON schema
{
   "title": "test-receive-addresses",
   "description": "test-receive-addresses script parameters",
   "type": "object",
   "properties": {
      "channels_per_port": {
         "default": 1,
         "description": "Number of channels per port",
         "title": "Number of channels per port",
         "type": "integer"
      },
      "max_ports_per_node": {
         "default": null,
         "description": "Maximum number of ports required per Node",
         "title": "Maximum number of ports required per Node",
         "type": "integer"
      },
      "num_nodes": {
         "default": 1,
         "description": "The total number of nodes required",
         "title": "Number of nodes required",
         "type": "integer"
      },
      "port_start": {
         "default": 9000,
         "description": "The starting value for the port range",
         "title": "Starting Port Value",
         "type": "integer"
      },
      "time_to_ready": {
         "default": 0,
         "description": "Time the script sleeps, after which the subarray transitions to READY ObsState if Configure is executed",
         "title": "Time to script being ready",
         "type": "integer"
      }
   },
   "additionalProperties": false
}

Config:
  • strict: bool = True

  • extra: str = forbid

  • arbitrary_types_allowed: bool = False

  • validate_assignment: bool = True

  • title: str = test-receive-addresses

Fields:
field channels_per_port: int = 1

Number of channels per port

field max_ports_per_node: int = None

Maximum number of ports required per Node

field num_nodes: int = 1

The total number of nodes required

field port_start: int = 9000

The starting value for the port range

field time_to_ready: int = 0

Time the script sleeps, after which the subarray transitions to READY ObsState if Configure is executed

Changelog

1.0.3

  • Update to ska-sdp-scripting 3.0.1 (MR422)

1.0.2

  • use ska-sdp-scripting 2.0.0 (MR360)

1.0.1

  • Update ska-sdp-scripting to 1.2.0 (MR308)

1.0.0

  • Update ska-sdp-scripting to 1.0.0 (MR248)

  • Update Dockerfile to use SKA python base image (MR211)

0.10.0

  • Update ska-sdp-scripting to 0.12.0 (MR202)

  • Processing script reports internal errors in pb state (MR185)

  • Pydantic model included in documentation (MR189)

  • JSON parameter schema added to tmdata (MR186)

  • Validate processing block parameters using scripting library 0.10.0 (MR180)

  • Added processing block parameter JSON schema and Pydantic model (MR174, MR177)

0.9.0

  • Update to scripting library 0.9.0 and use ska-sdp-python base image (MR166)

  • Set up skart for dependency updates of processing scripts (MR156)

  • Use poetry for dependency management (MR155)

0.8.0

  • Use ska-sdp-scripting 0.7.0, which implements a correct version of setting hosts and ports in receive addresses

  • BREAKING This and newer versions are not compatible with SDP version < 0.21.0

0.7.1

  • Update to scripting library ^= 0.6.3

0.7.0

  • Update to scripting library 0.6.1

0.6.1

  • Update to latest scripting library (0.5.2).

0.6.0

  • Update to latest scripting library (0.5.0). This required the update of how phase.wait_loop is used in the script.

0.5.0

  • Update scripting library to 0.4.1.

  • Produce receive addresses in new schema.

  • Set status to READY when script is ready to do its (fake) processing.

0.4.0

  • Port to use SDP scripting library (formerly known as the workflow library).

0.3.7

  • Use dependencies from the central artefact repository and publish the workflow image there.

0.3.6

  • Ported to use the latest version of workflow library (0.2.4).

0.3.5

  • Use python:3.9-slim as the base OCI image