Skip to content

Commit

Permalink
WCS memleak fix + same schedtel-generated fnames fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WWGolay committed Jan 2, 2025
1 parent 7c9e156 commit 9d97887
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pyscope/telrun/schedtel.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,8 @@ def schedtel_cli(
if block.name == ""
else block.name.replace(" ", "_").replace(".", "_")
),
start_time=block.start_time.isot.replace(":", "-").split(".")[0],
end_time=block.end_time.isot.replace(":", "-").split(".")[0],
start_time=block.start_time.isot.replace(":", "-").replace(".", "_"),
end_time=block.end_time.isot.replace(":", "-").replace(".", "_"),
duration="%i" % block.duration.to(u.second).value,
ra=block.target.ra.to_string(
sep="hms", unit="hourangle", precision=2, pad=True
Expand Down
22 changes: 21 additions & 1 deletion pyscope/telrun/telrun_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,16 @@ def execute_block(self, *args, slew=True, **kwargs):
history=hist,
overwrite=True,
)
# if the length of _wcs_threads exceeds 7, join the first thread in the list
if len(self._wcs_threads) > 7:
logger.info(
"Main thread + 7 wcs threads currently running, waiting for the first wcs thread to finish before continuing..."
)
self._wcs_threads[0].join()
self._wcs_threads = self._wcs_threads[1:]
logger.info(
"Main thread + 6 wcs threads currently running, continuing..."
)
self._wcs_threads.append(
threading.Thread(
target=self._async_wcs_solver,
Expand Down Expand Up @@ -2158,6 +2168,16 @@ def execute_block(self, *args, slew=True, **kwargs):
history=hist,
overwrite=True,
)
# if the length of _wcs_threads exceeds 7, join the first thread in the list
if len(self._wcs_threads) > 7:
logger.info(
"Main thread + 7 wcs threads currently running, waiting for the first wcs thread to finish before continuing..."
)
self._wcs_threads[0].join()
self._wcs_threads = self._wcs_threads[1:]
logger.info(
"Main thread + 6 wcs threads currently running, continuing..."
)
self._wcs_threads.append(
threading.Thread(
target=self._async_wcs_solver,
Expand Down Expand Up @@ -2479,7 +2499,7 @@ def _async_wcs_solver(
# parity=2,
# tweak_order=3,
# crpix_center=True,
# solve_timeout=self.wcs_timeout,
solve_timeout=60,
)
elif self.wcs_solver.lower() == "maxim_pinpoint_wcs":
from ..reduction import maxim_pinpoint_wcs
Expand Down

0 comments on commit 9d97887

Please sign in to comment.