-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: develop
Are you sure you want to change the base?
Conversation
WHERE imageDate =~ /{day}/ AND imageNumber = {seq} | ||
""" | ||
|
||
time = await self.client.influx_client.query(query) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from .apply_dof import ApplyDOF | ||
|
||
STD_TIMEOUT = 30 | ||
|
||
EFD_SERVER_URL = dict( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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()
?
No description provided.