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

Make ttl a float #3166

Merged
merged 16 commits into from
Mar 26, 2024
Merged

Make ttl a float #3166

merged 16 commits into from
Mar 26, 2024

Conversation

jafermarq
Copy link
Contributor

@jafermarq jafermarq commented Mar 21, 2024

  • make ttl a float
  • define a default ttl in common.message as DEFAULT_TTL=3600
  • replace all instances of ttl="" with ttl=DEFAULT_TTL
  • Update logic that checks for validity of taskins/taskres and message

examples/app-pytorch/client_low_level.py Outdated Show resolved Hide resolved
src/py/flwr/server/driver/driver.py Outdated Show resolved Hide resolved
src/py/flwr/server/superlink/state/in_memory_state.py Outdated Show resolved Hide resolved
src/py/flwr/server/superlink/state/in_memory_state.py Outdated Show resolved Hide resolved
@jafermarq jafermarq changed the title Make ttl and int Make ttl a float Mar 25, 2024
@jafermarq jafermarq marked this pull request as ready for review March 25, 2024 14:49
Time-to-live for this message.
"""
# Create reply with error
message = Message(metadata=self._create_reply_metadata(ttl), error=error)
return message

def create_reply(self, content: RecordSet, ttl: str) -> Message:
def create_reply(self, content: RecordSet, ttl: float = DEFAULT_TTL) -> Message:
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the default be the TTL of the instruction message?

We'd need to make ttl an optional argument here and also add a check below that sets ttl to the TTL of the instruction message if the user does not set the ttl argument. We should probably also check that a user-provided TTL does not exceed the instruction message TTL.

Suggested change
def create_reply(self, content: RecordSet, ttl: float = DEFAULT_TTL) -> Message:
def create_reply(self, content: RecordSet, ttl: Optional[float] = None) -> Message:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my understanding was that theSuperNode-side TTL was to specify the max duration the TaskRes is allowed to remain at the SuperLink before it gets pulled by the ServerApp (so they are different TTLs)

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've made the change to make it optional. But to keep things consistent, in this PR if the ttl is unset, it will set DEFAULT_TTL. In a follow up PR we'll replace it to what we agreed upon (the remaining time based on message creation and it's ttl from serverapp)

@danieljanes danieljanes merged commit 3acdf47 into main Mar 26, 2024
28 checks passed
@danieljanes danieljanes deleted the ttl-revision-1 branch March 26, 2024 19:57
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