Struct ControlMessageProxy

struct ControlMessageProxy

Public Static Functions

static std::shared_ptr<ControlMessage> create(pybind11::dict &config)

Creates a new ControlMessage instance from a configuration dictionary.

Parameters

config – A pybind11::dict representing the configuration for the ControlMessage.

Returns

A shared_ptr to a newly created ControlMessage instance.

static std::shared_ptr<ControlMessage> create(std::shared_ptr<ControlMessage> other)

Creates a new ControlMessage instance as a copy of an existing one.

Parameters

other – A shared_ptr to another ControlMessage instance to copy.

Returns

A shared_ptr to the newly copied ControlMessage instance.

static std::shared_ptr<ControlMessage> copy(ControlMessage &self)

Creates a deep copy of the ControlMessage instance.

Parameters

self – Reference to the underlying ControlMessage object.

Returns

A shared_ptr to the copied ControlMessage instance.

static pybind11::dict config(ControlMessage &self)

Retrieves the configuration of the ControlMessage as a dictionary.

Parameters

self – Reference to the underlying ControlMessage object.

Returns

A pybind11::dict representing the ControlMessage’s configuration.

static void config(ControlMessage &self, pybind11::dict &config)

Updates the configuration of the ControlMessage from a dictionary.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • config – A pybind11::dict representing the new configuration.

static void add_task(ControlMessage &self, const std::string &type, pybind11::dict &task)

Adds a task to the ControlMessage.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • type – The type of the task to be added.

  • task – A pybind11::dict representing the task to be added.

static pybind11::dict remove_task(ControlMessage &self, const std::string &type)

Removes and returns a task of the given type from the ControlMessage.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • type – The type of the task to be removed.

Returns

A pybind11::dict representing the removed task.

static pybind11::dict get_tasks(ControlMessage &self)

Retrieves all tasks from the ControlMessage.

Parameters

self – Reference to the underlying ControlMessage object.

Returns

A pybind11::dict containing all tasks.

static void set_metadata(ControlMessage &self, const std::string &key, pybind11::object &value)

Sets a metadata key-value pair.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • key – The key for the metadata entry.

  • value – The value for the metadata entry, must be JSON serializable.

static pybind11::object get_metadata(ControlMessage &self, const pybind11::object &key, pybind11::object default_value)

Retrieves a metadata value by key, with an optional default value.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • key – The key for the metadata entry. If not provided, retrieves all metadata.

  • default_value – An optional default value to return if the key does not exist.

Returns

The value associated with the key, the default value if the key is not found, or all metadata if the key is not provided.

static pybind11::list list_metadata(ControlMessage &self)

Lists all metadata keys of the ControlMessage.

Parameters

self – Reference to the underlying ControlMessage object.

Returns

A pybind11::list containing all metadata keys.

static void payload_from_python_meta(ControlMessage &self, const pybind11::object &meta)

Set the payload object given a Python instance of MessageMeta.

Parameters

meta

static void set_timestamp(ControlMessage &self, const std::string &key, pybind11::object timestamp)

Sets a timestamp for a given key.

This method directly takes a datetime.datetime object from Python and sets the corresponding std::chrono::system_clock::time_point for the specified key in the ControlMessage object.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • key – The key associated with the timestamp.

  • timestamp – A datetime.datetime object representing the timestamp.

static pybind11::object get_timestamp(ControlMessage &self, const std::string &key, bool fail_if_nonexist = false)

Retrieves the timestamp for a specific key from the ControlMessage object.

This method fetches the timestamp associated with the specified key and returns it as a datetime.datetime object in Python. If the timestamp does not exist and fail_if_nonexist is true, an exception is raised.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • key – The specific key for which the timestamp is requested.

  • fail_if_nonexist – Determines the behavior when the requested timestamp does not exist. If true, an exception is thrown. If false, py::none is returned.

Returns

A datetime.datetime object representing the timestamp if found, or py::none if not found and fail_if_nonexist is false.

static pybind11::dict filter_timestamp(ControlMessage &self, const std::string &regex_filter)

Retrieves timestamps for all keys that match a regex pattern from the ControlMessage object.

This method retrieves all timestamps within the ControlMessage object that match a specified regex pattern. Each key and its associated timestamp are returned in a Python dictionary, with timestamps represented as datetime.datetime objects.

Parameters
  • self – Reference to the underlying ControlMessage object.

  • regex_filter – The regex pattern that keys must match to be included in the result.

Returns

A Python dictionary of matching keys and their timestamps as datetime.datetime objects.

Previous Struct AddScoresStageInterfaceProxy
Next Struct CudaError
© Copyright 2024, NVIDIA. Last updated on Apr 11, 2024.