Domain¶
-
class
lsst.ts.salobj.Domain¶ Bases:
objectdds domain participant and quality of service information.
Notes
Reads the following Environment Variables; follow the link for details:
- LSST_DDS_IP (optional) is used to set the
hostattribute. If provided, it must be a dotted numeric IP address, e.g. “192.168.0.1”. - OSPL_MASTER_PRIORITY (optional) is used to set the Master Priority. If present, it must be a value between 0 and 255.
Cleanup
It is important to close a
Domainwhen you are done with it, especially in unit tests, because otherwise unreleased resources may cause problems. To make this easierDomainis a context manager.Domaincontains a registry ofSalInfoinstances, so that it can close them when the domain is closed. The registry uses weak references to avoid circular dependencies (since SalInfo stores the domain).SalInfoinstances automatically register themselves with the provided domain.To conserve resources you should have only one
Domainper process. Thus:Controllercreates its own Domain as attributedomainand closes it when the controller is closed. To create aRemotefor a controller, use the domain from the controller, e.g.:controller = Controller(name="Test", index=47) try: remote = Remote(domain=controller.domain, name="Test", index=47) ... finally: await controller.close() # or if you only want the objects for the duration of a function, # e.g in a unit test: async with Controller(name="Test", index=47) as controller: remote = Remote(domain=controller.domain, name="Test", index=47) ...
If you are creating
Remotes without aControllerthen you must create the Domain yourself and close it when you are finished, e.g.:domain = salobj.Domain() try: remote = salobj.Remote(domain=domain, name="Test", index=47) ... finally: await domain.close() # or if you only want the objects for the duration of a function, # e.g in a unit test: async with salobj.Domain() as domain: test_remote = salobj.Remote(domain=domain, name="Test", index=5)
Attributes: - participant :
dds.DomainParticipant DDS domain participant.
- host :
int Value for the
private_hostfield of output samples. See environment variableLSST_DDS_IPfor details.- origin :
int Process ID. Used to set the
private_originfield of output samples.- idl_dir :
pathlib.Path Root directory of the
ts_idlpackage.- qos_provider :
dds.QosProvider Quality of service provider.
- topic_qos :
dds.Qos Quality of service for non-volatile DDS topics (those that want late-joiner data).
- volatile_topic_qos :
dds.Qos Quality of service for volatile topics (those that do not want any late-joiner data). Note: we cannot just make readers volatile to avoid late-joiner data, as volatile readers receive late-joiner data from non-volatile writers. So we make readers, writers, and topics all volatile. According to ADLink it is a feature, not a bug.
- reader_qos :
dds.Qos Quality of service for non-volatile DDS readers.
- volatile_reader_qos :
dds.Qos Quality of service for volatile DDS readers.
- writer_qos :
dds.Qos Quality of service for non-volatile DDS writers.
- volatile_writer_qos :
dds.Qos Quality of service for volatile DDS writers.
Attributes Summary
salinfo_setMethods Summary
add_salinfo(salinfo)Add the specified salinfo to the internal registry. close()Close all registered SalInfoand the dds domain participant.close_dds()Close the dds DomainParticipant. remove_salinfo(salinfo)Remove the specified salinfo from the internal registry. Attributes Documentation
-
salinfo_set¶
Methods Documentation
-
add_salinfo(salinfo)¶ Add the specified salinfo to the internal registry.
Parameters: - salinfo :
SalInfo SAL component information
Raises: - RuntimeError
If the salinfo is already present
- salinfo :
-
close()¶ Close all registered
SalInfoand the dds domain participant.May be called multiple times. The first call closes the Domain; subsequent calls wait until the Domain is closed.
-
close_dds()¶ Close the dds DomainParticipant.
- LSST_DDS_IP (optional) is used to set the