Introduction

Reference Documents

[RD1]
Central Control System Development Standards;

Metadata Acquisition Interface

Metadata acquisition interface, metadaqif, is a relatively small interface used by components that provide metadata to FITS data products created by OCM and DPM.

The following sections document the interface in a language agnostic manner. For data structures only the data members are documented, not the accessors generated by MAL. Similarly names are not fully qualified as it is different across the supported languages.

Interfaces

class metadaqif.MetaDaq

Metadata acquisition interface.

StartDaq(id) → DaqReply

Start new data acquisition that is eventually stopped with StopDaq() or aborted with AbortDaq().

Note

If id is not provided (left empty) it is expected that the server implementing the interface will generate a unique identifier automatically.

If the same id is reused it should be considered a fatal error.

Parameters

id (str) – Optional (may be empty) unique identifier of data acquisition.

Returns

If id was provided that is returned as an acknowledgement, otherwise the id generated by server is returned.

Return type

DaqReply

Raises

DaqException – On fatal error.

StopDaq(id) → DaqStopReply

Stops data acquisition and returns created FITS filenames and/or keywords. Produced files should be closed so it is safe to immediately read them.

If an error occurrsed such that the acquisition has failed this is communicated by throwing an exception.

Parameters

id (str) – Id of data acquisition to stop.

Returns

Structure containing produced FITS files and/or FITS keywords.

Return type

DaqStopReply

Raises

DaqException – On fatal error.

AbortDaq(id) → DaqReply

Aborts data acquisition and discards any data that has been acquired.

Parameters

id (str) – Id of data acquisition to abort.

Return type

DaqReply

Raises

DaqException – On fatal error.

GetDaqStatus(id) → DaqStatus

Get status of current or past Data Acquisitions.

It is unspecified exactly how far back the history should go. But the bare minimum is to be able to provide status for last two (e.g. any current and previous).

Parameters

id (str) – Id of data acquisition to get status for.

Return type

DaqStatus

Raises

DaqException – On fatal error.

Data Structures

class metadaqif.DaqState

Enumeration of data acquisition states. The expected state transitions are as follows:

digraph DaqStates {
    # Config
    node [shape=Mrecord,fontname=helvetica,fontsize=11];
    graph [fontname = "helvetica", bgcolor=transparent];

    # States
    NotStarted [label="{NotStarted|\l}"];
    Acquiring [label="{Acquiring|\l}"];
    Succeeded [label="{Succeeded|\l}"];
    Aborted [label="{Aborted|\l}"];
    Failed [label="{Failed|\l}"];

    # Transitions
    NotStarted -> Acquiring;
    Acquiring -> Succeeded;

    edge [weight=0];
    Acquiring -> {Aborted, Failed};
}

Note

There may be more internal (transitional states) but this enumeration covers the ones that are observable with metadaqif.

NotStarted

Data Acquisition is created but not yet started.

Acquiring

Data is being acquired.

Succeeded

Final state for a successful Data Acquisition. All data has been acquired and any FITS files are completed and closed.

Aborted

Final state for an aborted Data Acquisition.

Failed

Final state for failed Data Acquisition.

class metadaqif.DaqException

Exception used by MetaDaq.

id: str

Data Acquisition identifier.

message: str

Exception message.

class metadaqif.DaqStatus

Contains the Data Acquisition reply.

id: str

Data Acquisition identifier.

state: DaqState

Data Acquisition state at the time the reply was sent.

message: str

Message, if any.

files: List[str]

List of FITS files created for this Data Acquisition in the format [user@]host:/absolute/path.

keywords: str

JSON-encoded FITS keywords, or empty.

Example:

[
   {
      "type":"valueKeyword",
      "name":"OBJECT",
      "value":"OBJECT,SKY"
   },
   {
      "type":"esoKeyword",
      "name":"OBS TPLNO",
      "value":2
   }
]
timestamp: double

Timestamp of last status update in number of seconds in TAI time standard with epoch set to 1 January 1970 00:00:00 TAI, which is 31 December 1969 23:59:51.999918 UTC [RD1].

class metadaqif.DaqReply

Common reply type.

id: str

Data Acquisition identifier.

class metadaqif.DaqStopReply

Reply structure for DaqStop.

id: str

Data Acquisition identifier.

files: List[str]

List of FITS files created for this Data Acquisition in the format [user@]host:/absolute/path.

keywords: str

JSON-encoded FITS keywords, or empty.

Example:

[
   {
      "type":"valueKeyword",
      "name":"OBJECT",
      "value":"OBJECT,SKY"
   },
   {
      "type":"esoKeyword",
      "name":"OBS TPLNO",
      "value":2
   }
]