Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tickets/DM-47601: Add sync dof script #251

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open

Conversation

gmegh
Copy link
Contributor

@gmegh gmegh commented Dec 4, 2024

No description provided.

@gmegh gmegh requested a review from tribeiro December 4, 2024 20:36
WHERE imageDate =~ /{day}/ AND imageNumber = {seq}
"""

time = await self.client.influx_client.query(query)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to make some validation here that it returns something... what if the users passed a bad image number?

lookback_interval = TimeDelta(1, format="jd")
max_lookback_days = 7

while True:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is a good idea. I would actually be a bit more aggressive here in limiting the look back and search only between the image the user asked and the previous image (something like seq and seq-1), and if there are no event in that time frame you fail the script.

async def run(self) -> None:
"""Run script."""
# Assert feasibility
await self.assert_feasibility()

if self.day is not None and self.seq is not None:
self.client = EfdClient("summit_efd")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that you are hard-coding which EFD to use here, which means we won't be able to test this script at BTS or TTS.

Consider doing something like the BaseBlockScript script does. See here and here.

from .apply_dof import ApplyDOF

STD_TIMEOUT = 30

EFD_SERVER_URL = dict(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are not URLs, so please, rename this something else. Maybe EFD_NAMES?

super(ApplyDOF, self).configure(config)

if hasattr(config, "day") and hasattr(config, "seq"):
self.day = config.day
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, self.day and self.seq are only created here and later you try to access them. consider doing:

self.day = getattr(config, "day", None)
self.seq = getattr(config, "seq", None)

# Assert feasibility
await self.assert_feasibility()

if self.day is not None and self.seq is not None:
efd_name = await self.get_efd_name()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you move all this to a method and here you just do:

if self.day is not None and self.seq is not None:
    self.dofs = await self.get_last_issued_state()

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants