Skip to content

Commit

Permalink
Adding model lineage and deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
mkepurcell committed Jan 18, 2021
1 parent 217572c commit d0996fa
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
35 changes: 35 additions & 0 deletions pycloudmessenger/ffl/fflapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,24 @@ def user_assignments(self) -> list:
message = self.catalog.msg_user_assignments()
return self._invoke_service(message)

def model_delete(self, task_name: str, timeout: int = 0):
'''
Requests a model deletion
Throws: An exception on failure
Returns: None
'''
message = self.catalog.msg_model_delete(task_name)
return self._invoke_service(message, timeout)

def model_lineage(self, task_name: str, timeout: int = 0) -> list:
'''
Requests the model lineage for task 'task_name'
Throws: An exception on failure
Returns: list
'''
message = self.catalog.msg_model_lineage(task_name)
return self._invoke_service(message, timeout)

def model_info(self, task_name: str) -> dict:
"""
Returns model info.
Expand Down Expand Up @@ -795,6 +813,23 @@ def get_model(self, task_name: str) -> list:
"""
return self.messenger.model_info(task_name)

def model_lineage(self, task_name: str) -> list:
"""
Returns a list with model lineage
Throws: An exception on failure
:return: list of all the available models
:rtype: `list`
"""
return self.messenger.model_lineage(task_name)

def delete_model(self, task_name: str):
"""
Deletes a model for given task
Throws: An exception on failure
:return: nothing
"""
return self.messenger.model_delete(task_name)



##########################################################################
Expand Down
20 changes: 20 additions & 0 deletions pycloudmessenger/ffl/message_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,23 @@ def msg_model_info(self, task_name: str) -> dict:
template, args = self._msg_template()
args.append({'cmd': 'model_info', 'params': [task_name]})
return template

def msg_model_delete(self, task_name: str):
'''
Formats a message for requesting a model deletion for a task
Throws: An exception on failure
Returns: None
'''
template, args = self._msg_template()
args.append({'cmd':'model_delete', 'params': [task_name]})
return template

def msg_model_lineage(self, task_name: str) -> dict:
'''
Formats a message for requesting model lineage for a task
Throws: An exception on failure
Returns: dict with model lineage
'''
template, args = self._msg_template()
args.append({'cmd':'model_lineage', 'params': [task_name]})
return template
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pycloudmessenger',
version='0.7.0',
version='0.7.1',
description='Package for interacting with messaging based cloud services from IBM Research Ireland',
author='Mark Purcell',
author_email='[email protected],[email protected]',
Expand Down

0 comments on commit d0996fa

Please sign in to comment.