Fetches key data from start document of the selected run Parameters ---------- run_id_uid: int or str Run ID (positive or negative int) or UID (str, full or short) of the run. catalog_name: str or None Name of the catalog (e.g. `"srx"`). The function attempts to
(run_id_uid, catalog_name=None)
| 141 | |
| 142 | |
| 143 | def fetch_run_info(run_id_uid, catalog_name=None): |
| 144 | """ |
| 145 | Fetches key data from start document of the selected run |
| 146 | |
| 147 | Parameters |
| 148 | ---------- |
| 149 | run_id_uid: int or str |
| 150 | Run ID (positive or negative int) or UID (str, full or short) of the run. |
| 151 | catalog_name: str or None |
| 152 | Name of the catalog (e.g. `"srx"`). The function attempts to determine the catalog |
| 153 | name automatically if the parameter is not specified or `None`. |
| 154 | |
| 155 | Returns |
| 156 | ------- |
| 157 | int or str |
| 158 | Run ID (always positive int) or Run UID (str, always full UID). Returns |
| 159 | `run_id=-1` and `run_uid=""` in case of failure. |
| 160 | |
| 161 | Raises |
| 162 | ------ |
| 163 | RuntimeError |
| 164 | failed to fetch the run from Databroker |
| 165 | """ |
| 166 | try: |
| 167 | if catalog_name: |
| 168 | catalog = get_catalog(catalog_name) |
| 169 | else: |
| 170 | catalog = db |
| 171 | hdr = catalog[run_id_uid] |
| 172 | |
| 173 | hdr = catalog[run_id_uid] |
| 174 | run_id = hdr.start["scan_id"] |
| 175 | run_uid = hdr.start["uid"] |
| 176 | except Exception: |
| 177 | if isinstance(run_id_uid, int): |
| 178 | msg = f"ID {run_id_uid}" |
| 179 | else: |
| 180 | msg = f"UID '{run_id_uid}'" |
| 181 | raise RuntimeError(f"Failed to find run with {msg}.") |
| 182 | return run_id, run_uid |
| 183 | |
| 184 | |
| 185 | def fetch_data_from_db( |
no test coverage detected