Skip to content

Commit

Permalink
Remove option to re-enable a tile since API doesn't allow it
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Feb 26, 2025
1 parent 9087cce commit 7e66fa6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
6 changes: 1 addition & 5 deletions src/gort/gort.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,7 @@ async def observe(
)
continue

await set_tile_status(
tile_id,
enabled=False,
note="Acquisition failed",
)
await set_tile_status(tile_id, note="Acquisition failed")
self.log.warning(
f"tile_id={tile_id} has been disabled. Continuing observations."
)
Expand Down
1 change: 0 additions & 1 deletion src/gort/overwatcher/troubleshooter/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ async def _handle_internal(self, error_model: TroubleModel) -> bool:
else:
await set_tile_status(
tile_id,
enabled=False,
note=f"Acquisition failed: {decap(error_model.message)}",
)
await self.notify(
Expand Down
10 changes: 1 addition & 9 deletions src/gort/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,18 +759,10 @@ def set_spec_coords(

return self.spec_coords

async def enable(self):
"""Enables the tile for observation."""

if self.tile_id is None:
raise TileError("Cannot enable tile without a tile_id.")

await set_tile_status(self.tile_id, enabled=True)

async def disable(self, note: str | None = None):
"""Disables the tile for observation."""

if self.tile_id is None:
raise TileError("Cannot disable tile without a tile_id.")

await set_tile_status(self.tile_id, enabled=False, note=note)
await set_tile_status(self.tile_id, note=note)
4 changes: 2 additions & 2 deletions src/gort/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def mark_exposure_bad(tile_id: int, dither_position: int = 0):
).execute()


async def set_tile_status(tile_id: int, enabled: bool = True, note: str | None = None):
async def set_tile_status(tile_id: int, note: str | None = None):
"""Enables/disables a tile in the database."""

sch_config = config["services"]["scheduler"]
Expand All @@ -254,7 +254,7 @@ async def set_tile_status(tile_id: int, enabled: bool = True, note: str | None =
async with httpx.AsyncClient() as client:
resp = await client.put(
f"http://{host}:{port}/tile_status",
params={"tile_id": tile_id, "disable": not enabled, "note": note},
params={"tile_id": tile_id, "note": note},
json={},
follow_redirects=True,
)
Expand Down

0 comments on commit 7e66fa6

Please sign in to comment.