refactor: add _send_requests_delete
This commit is contained in:
parent
d2cd6a442b
commit
4ce26b5dd5
@ -332,11 +332,32 @@ class PilatuscSAXS(DetectorBase):
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.info(f"Pilatus2 wait threw Exception: {exc}")
|
logger.info(f"Pilatus2 wait threw Exception: {exc}")
|
||||||
|
|
||||||
|
def _send_requests_put(self, url: str, data_msg: dict = None, headers: dict = None) -> None:
|
||||||
|
...
|
||||||
|
|
||||||
|
def _send_requests_delete(self, url: str, headers: dict = None) -> None:
|
||||||
|
"""
|
||||||
|
Send a delete request to the given url
|
||||||
|
|
||||||
|
Args:
|
||||||
|
url (str): url to send the request to
|
||||||
|
headers (dict): headers to be sent with the request (optional)
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
res = requests.delete(url=url, headers=headers)
|
||||||
|
if not res.ok:
|
||||||
|
res.raise_for_status()
|
||||||
|
except Exception as exc:
|
||||||
|
logger.info(f"Pilatus2 delete threw Exception: {exc}")
|
||||||
|
|
||||||
def _close_file_writer(self) -> None:
|
def _close_file_writer(self) -> None:
|
||||||
"""Close the file writer for pilatus_2
|
"""Close the file writer for pilatus_2
|
||||||
a zmq service is running on xbl-daq-34 that is waiting
|
a zmq service is running on xbl-daq-34 that is waiting
|
||||||
for a zmq message to stop the writer for the pilatus_2 x12sa-pd-2
|
for a zmq message to stop the writer for the pilatus_2 x12sa-pd-2
|
||||||
"""
|
"""
|
||||||
|
url = "http://x12sa-pd-2:8080/stream/pilatus_2"
|
||||||
|
self._send_requests_delete(url=url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = requests.delete(url="http://x12sa-pd-2:8080/stream/pilatus_2")
|
res = requests.delete(url="http://x12sa-pd-2:8080/stream/pilatus_2")
|
||||||
if not res.ok:
|
if not res.ok:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user