Skip to content

chore: Request status tracking #18

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

Merged
merged 18 commits into from
Aug 22, 2024
Merged

chore: Request status tracking #18

merged 18 commits into from
Aug 22, 2024

Conversation

Raalsky
Copy link
Contributor

@Raalsky Raalsky commented Aug 20, 2024

No description provided.

if not self._sync_process.is_alive():
if verbose:
logger.warning("Sync process is not running")
return # No need to wait if the sync process is not running
Copy link
Contributor

Choose a reason for hiding this comment

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

If sync process is dead, shouldn't we signal an error? It's not situation normal, and we have no means of restarting it (and we shouldn't)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will (separate PR that should rework the signal handling)

return None

items = []
for i in range(min(size, min(max_size, size))):
Copy link
Contributor

Choose a reason for hiding this comment

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

min(size, max_size), or did you mean something different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh, good catch. I'm blaming Copilot as I was certain that it was range(min(size, max_size)) before some refactors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Raalsky Raalsky force-pushed the rj/basic-submission-flow branch from a89c60f to e9659f3 Compare August 21, 2024 14:02
Base automatically changed from rj/basic-submission-flow to main August 21, 2024 16:59
@Raalsky Raalsky force-pushed the rj/requests-tracking branch from 3d68f02 to 7e77204 Compare August 21, 2024 17:17
@Raalsky Raalsky marked this pull request as ready for review August 21, 2024 21:09
@Raalsky Raalsky requested a review from normandy7 August 21, 2024 21:09
)


def should_print_message(last_message_printed: Optional[float]) -> bool:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kgodlewski I've done the refactor requested by you in previous PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this user-facing? If so, what's the purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not 😉

)


def should_print_message(last_message_printed: Optional[float]) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this user-facing? If so, what's the purpose?

{h1}
----NeptuneRunDuplicate--------------------------------------------------------
{end}
Identical run already exists.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is raised when you create a run with an existing ID but without resume=True?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.
This will trigger error above:

with Run(run_id=run_id, family=run_id):
    ...

with Run(run_id=run_id, family=run_id):
    ...

This works:

with Run(run_id=run_id, family=run_id):
    ...

with Run(run_id=run_id, family=run_id, resume=True):
    ...

Raalsky and others added 10 commits August 22, 2024 14:08
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
else:
if last_message_printed is None or time.time() - last_message_printed > STOP_MESSAGE_FREQUENCY:
if verbose and should_print_message(last_message_printed):
Copy link
Contributor

@kgodlewski kgodlewski Aug 22, 2024

Choose a reason for hiding this comment

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

tiny detail, but in the future we could do:

def print_message(msg: str, last_print_timestamp: Optional[float], verbose: bool) -> float, the func would return the current time if it printed the message. So we could just do:

last_message_printed = print_message(f"some message", last_message_printed, verbose)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

items.append(item)
return items

def commit(self, n: int) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Not just now, but we need a different name here, don't know just yet how different ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm actually making it even more common name (introduced commit to all of the threads); let's address that in next PR to get a better context

return MockedApiClient()
return HostedApiClient(api_token=api_token)


class SyncThread(Daemon, WithResources):
Copy link
Contributor

Choose a reason for hiding this comment

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

How about renaming this to SenderThread, or ApiSenderThread, or something that is less generic than Sync?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SenderThread works for me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -283,7 +400,11 @@ def work(self) -> None:
try:
run_operation = RunOperation()
run_operation.ParseFromString(data)
self.submit(operation=run_operation)
request_id = self.submit(operation=run_operation)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we ever return None from self.submit -> Reponse.parsed? I mean, if the backend fails to return a proper RequestId, I think we should raise an error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's a address that in next PR

@kgodlewski kgodlewski merged commit bdf1251 into main Aug 22, 2024
4 checks passed
@kgodlewski kgodlewski deleted the rj/requests-tracking branch August 22, 2024 13:08
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.

3 participants