/  Python Yamcs Client  /  General Client  /  YamcsClient

YamcsClient

class yamcs.client.YamcsClient(address, **kwargs)

Bases: object

Client for accessing core Yamcs resources.

Parameters
  • address (str) – The address of Yamcs in the format ‘hostname:port’

  • tls (Optional[bool]) – Whether TLS encryption is expected

  • tls_verify (Optional[Union[bool, str]]) – Whether server certificate verification is enabled (only applicable if tls=True). As an alternative to a boolean value, this option may be set to a path containing the appropriate TLS CA certificate bundle.

  • credentials (Optional[Credentials]) – Credentials for when the server is secured

  • user_agent (Optional[str]) – Optionally override the default user agent

create_event_subscription(instance, on_data, timeout=60)

Create a new subscription for receiving events of an instance.

This method returns a future, then returns immediately. Stop the subscription by canceling the future.

Parameters
  • instance (str) – A Yamcs instance name

  • on_data (Optional[Callable[Event])) – Function that gets called on each Event.

  • timeout (Optional[float]) – The amount of seconds to wait for the request to complete.

Returns

Future that can be used to manage the background websocket subscription.

Return type

WebSocketSubscriptionFuture

create_instance(name, template, args=None, labels=None)

Create a new instance based on an existing template. This method blocks until the instance is fully started.

Parameters
  • instance (str) – A Yamcs instance name.

  • template (str) – The name of an existing template.

Create a new subscription for receiving data link updates of an instance.

This method returns a future, then returns immediately. Stop the subscription by canceling the future.

Parameters
  • instance (str) – A Yamcs instance name.

  • on_data (Optional[Callable[LinkEvent])) – Function that gets called with LinkEvent updates.

  • timeout (Optional[float]) – The amount of seconds to wait for the request to complete.

Returns

Future that can be used to manage the background websocket subscription.

Return type

LinkSubscription

create_time_subscription(instance, on_data=None, timeout=60)

Create a new subscription for receiving time updates of an instance. Time updates are emitted at 1Hz.

This method returns a future, then returns immediately. Stop the subscription by canceling the future.

Parameters
  • instance (str) – A Yamcs instance name

  • on_data (Optional[Callable[datetime])) – Function that gets called with datetime updates.

  • timeout (Optional[float]) – The amount of seconds to wait for the request to complete.

Returns

Future that can be used to manage the background websocket subscription.

Return type

TimeSubscription

get_archive(instance)

Return an object for working with the Archive of the specified instance.

Parameters

instance (str) – A Yamcs instance name.

Return type

ArchiveClient

get_auth_info()

Returns general authentication information. This operation does not require authenticating and is useful to test if a server requires authentication or not.

Return type

AuthInfo

get_file_transfer_client(instance)

Return an object for working with file transfers on a specified instance.

Parameters

instance (str) – A Yamcs instance name.

Return type

FileTransferClient

Return an object for working with a specific Yamcs link.

Parameters
  • instance (str) – A Yamcs instance name.

  • link (str) – A link name within that instance.

Return type

LinkClient

get_mdb(instance)

Return an object for working with the MDB of the specified instance.

Parameters

instance (str) – A Yamcs instance name.

Return type

MDBClient

get_processor(instance, processor)

Return an object for working with a specific Yamcs processor.

Parameters
  • instance (str) – A Yamcs instance name.

  • processor (str) – A processor name within that instance.

Return type

ProcessorClient

get_server_info()

Return general server info.

Return type

ServerInfo

get_storage_client(instance='_global')

Return an object for working with object storage

Parameters

instance (str) – The storage instance.

Return type

StorageClient

get_tco_client(instance, service)

Return an object for Time Correlation API calls on a specified service.

Parameters
  • instance (str) – A Yamcs instance name.

  • service (str) – Target service name.

Return type

TCOClient

get_time(instance)

Return the current mission time for the specified instance.

Return type

datetime

get_user_info()

Get information on the authenticated user.

Return type

UserInfo

Deprecated. Use list_links(instance).

list_instance_templates()

List the available instance templates.

list_instances()

Lists the instances.

Instances are returned in lexicographical order.

Return type

Iterable[Instance]

Lists the data links visible to this client.

Data links are returned in random order.

Parameters

instance (str) – A Yamcs instance name.

Return type

Iterable[Link]

list_processors(instance=None)

Lists the processors.

Processors are returned in lexicographical order.

Parameters

instance (Optional[str]) – A Yamcs instance name.

Return type

Iterable[Processor]

list_services(instance)

List the services for an instance.

Parameters

instance (str) – A Yamcs instance name.

Return type

Iterable[Service]

restart_instance(instance)

Restarts a single instance.

Parameters

instance (str) – A Yamcs instance name.

send_event(instance, message, event_type=None, time=None, severity='info', source=None, sequence_number=None)

Post a new event.

Parameters
  • instance (str) – A Yamcs instance name.

  • message (str) – Event message.

  • event_type (Optional[str]) – Type of event.

  • severity (Optional[str]) – The severity level of the event. One of info, watch, warning, critical or severe. Defaults to info.

  • time (Optional[datetime]) – Time of the event. If unspecified, defaults to mission time.

  • source (Optional[str]) – Source of the event. Useful for grouping events in the archive. When unset this defaults to User.

  • sequence_number (Optional[int]) – Sequence number of this event. This is primarily used to determine unicity of events coming from the same source. If not set Yamcs will automatically assign a sequential number as if every submitted event is unique.

start_instance(instance)

Starts a single instance.

Parameters

instance (str) – A Yamcs instance name.

start_service(instance, service)

Starts a single service.

Parameters
  • instance (str) – A Yamcs instance name.

  • service (str) – The name of the service.

stop_instance(instance)

Stops a single instance.

Parameters

instance (str) – A Yamcs instance name.

stop_service(instance, service)

Stops a single service.

Parameters
  • instance (str) – A Yamcs instance name.

  • service (str) – The name of the service.

class yamcs.client.TimeSubscription(manager)

Bases: yamcs.core.futures.WebSocketSubscriptionFuture

Local object providing access to time updates.

A subscription object stores the last time info.

Initializes the future. Should not be called by clients.

time

The last time info.

Type

datetime

class yamcs.client.LinkSubscription(manager)

Bases: yamcs.core.futures.WebSocketSubscriptionFuture

Local object providing access to data link updates.

A subscription object stores the last link info for each link.

Initializes the future. Should not be called by clients.

Returns the latest link state.

Parameters

name (str) – Identifying name of the data link

Return type

Link

Returns a snapshot of all instance links.

Return type

Link[]