Skip to content

Commit

Permalink
Merge branch 'master' into feature/fedopt
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Hellander committed Jan 11, 2024
2 parents 846fafa + 96a7044 commit be5051b
Show file tree
Hide file tree
Showing 6 changed files with 640 additions and 74 deletions.
23 changes: 21 additions & 2 deletions fedn/fedn/network/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ def get_model_trail(self):
response = requests.get(self._get_url('get_model_trail'), verify=self.verify)
return response.json()

def list_models(self, session_id=None):
""" Get all models from the statestore.
:return: All models.
:rtype: dict
"""
response = requests.get(self._get_url('list_models'), params={'session_id': session_id}, verify=self.verify)
return response.json()

def list_clients(self):
""" Get all clients from the statestore.
Expand Down Expand Up @@ -175,7 +184,7 @@ def get_session(self, session_id):
response = requests.get(self._get_url(f'get_session?session_id={session_id}'), self.verify)
return response.json()

def set_package(self, path, helper):
def set_package(self, path: str, helper: str, name: str = None, description: str = None):
""" Set the compute package in the statestore.
:param path: The file path of the compute package to set.
Expand All @@ -186,7 +195,8 @@ def set_package(self, path, helper):
:rtype: dict
"""
with open(path, 'rb') as file:
response = requests.post(self._get_url('set_package'), files={'file': file}, data={'helper': helper}, verify=self.verify)
response = requests.post(self._get_url('set_package'), files={'file': file}, data={
'helper': helper, 'name': name, 'description': description}, verify=self.verify)
return response.json()

def get_package(self):
Expand All @@ -198,6 +208,15 @@ def get_package(self):
response = requests.get(self._get_url('get_package'), verify=self.verify)
return response.json()

def list_compute_packages(self):
""" Get all compute packages from the statestore.
:return: All compute packages with info.
:rtype: dict
"""
response = requests.get(self._get_url('list_compute_packages'), verify=self.verify)
return response.json()

def download_package(self, path):
""" Download the compute package.
Expand Down
Loading

0 comments on commit be5051b

Please sign in to comment.