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

Feature/SK-1071 | Initial refactor of client #722

Merged
merged 22 commits into from
Oct 11, 2024
Merged

Feature/SK-1071 | Initial refactor of client #722

merged 22 commits into from
Oct 11, 2024

Conversation

niklastheman
Copy link
Contributor

@niklastheman niklastheman commented Oct 7, 2024

fedn client start-v2 command added

OBS this PR does not replace the current client, it's and initial step to a new client (refactor)

Mainly tried to clean up the existing client. The existing client is left as is. The idea is to let this new solution exist in parallel until it can be the main solution. The functionality of the client is divided into three main classes, GrpcHandler, ClientApi and the "new" Client class. The Client class implements the ClientApi. The Client class can be understood as an example of how to set up your own client.

@github-actions github-actions bot added feature New feature or request minor labels Oct 7, 2024
@Wrede Wrede added the HOLD label Oct 7, 2024
@Wrede Wrede changed the title Feature/SK-1071 | Re-write python client Feature/SK-1071 | Re-write python client Oct 9, 2024
@Wrede Wrede changed the title Feature/SK-1071 | Re-write python client Feature/SK-1071 | Initial refactor of client Oct 9, 2024
Copy link
Member

@Wrede Wrede left a comment

Choose a reason for hiding this comment

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

I want @ahellander to look at this also

# Enum for respresenting the result of connecting to the FEDn API
class ConnectToApiResult(enum.Enum):
Assigned = 0
ComputePackgeMissing = 1
Copy link
Member

@ahellander ahellander Oct 10, 2024

Choose a reason for hiding this comment

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

Spelling error . ComputePackge-Z ComputePackage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix this.

Copy link
Member

@ahellander ahellander left a comment

Choose a reason for hiding this comment

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

Looks like a good refactor, I added two minor comments, but I'm sure this will be iterated on a number of times before replacing v1.

else:
raise ValueError(f"Unsupported event type: {event_type}")

def notify_subscribers(self, event_type: str, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand, what subscribers might a client have?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ahellander if you look in the client_v2.py file you can see how it is used. The overall idea is that client_api exposes functionality that a client can then make use of... In this particular example the client subscribes to events raised from the client_api. Events include training, validation or inference.

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 will add a little example too.

@Wrede Wrede removed the HOLD label Oct 11, 2024
@Wrede Wrede merged commit 6e41583 into master Oct 11, 2024
21 of 22 checks passed
@Wrede Wrede deleted the feature/SK-1071 branch October 11, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants