Skip to content

Commit

Permalink
Merge pull request #79 from anandhu-eng/docs-update
Browse files Browse the repository at this point in the history
Add list action for script and cache + corresponding gh actions
  • Loading branch information
arjunsuresh authored Feb 11, 2025
2 parents 3f89c49 + d7f0ab3 commit 602feaa
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test-mlc-core-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,13 @@ jobs:
mlc rm script get-ipol-src -f
mlc rm script --tags=app,image,corner-detection -f
mlc rm script 63080407db4d4ac4 -f
- name: Test 19 - list script
run: |
mlc list script
- name: Test 20 - list cache
run: |
mlc list cache

31 changes: 29 additions & 2 deletions mlc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,21 @@ def test(self, run_args):


def list(self, args):
logger.info("Listing all scripts.")
self.action_type = "script"
run_args = {"fetch_all": True} # to fetch the details of all the scripts present in repos registered in mlc

res = self.search(run_args)
if res['return'] > 0:
return res

logger.info(f"Listing all the scripts and their paths present in repos which are registered in MLC")
print("......................................................")
for item in res['list']:
print(f"alias: {item.meta['alias'] if item.meta.get('alias') else 'None'}")
print(f"Location: {item.path}")
print("......................................................")

return {"return": 0}


class ScriptExecutionError(Exception):
Expand Down Expand Up @@ -1579,7 +1593,20 @@ def show(self, run_args):
return {'return': 0}

def list(self, args):
logger.info("Listing all caches.")
self.action_type = "cache"
run_args = {"fetch_all": True} # to fetch the details of all the caches generated

res = self.search(run_args)
if res['return'] > 0:
return res

logger.info(f"Listing all the caches and their paths")
print("......................................................")
for item in res['list']:
print(f"tags: {item.meta['tags'] if item.meta.get('tags') else 'None'}")
print(f"Location: {item.path}")
print("......................................................")

return {'return': 0}

class ExperimentAction(Action):
Expand Down

0 comments on commit 602feaa

Please sign in to comment.