Skip to content

Commit 56607f6

Browse files
authored
Merge branch 'dev' into dev
2 parents fe3a99f + a206068 commit 56607f6

File tree

9 files changed

+278
-47
lines changed

9 files changed

+278
-47
lines changed

.github/workflows/test-mlc-core-actions.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,14 @@ jobs:
151151
mlc add repo my-new-repo
152152
mlc add repo https://github.com/mlcommons/inference
153153
mlc add repo https://mygit.com/myrepo
154-
154+
155+
' Disabled now as MLCFlow automatically deletes corrupted entries
155156
- name: Test 13 - rm repo where we have a corrupt entry
156157
run: |
157158
rm -r $HOME/MLC/repos/mlcommons@mlperf-automations
158159
mlc rm repo mlcommons@mlperf-automations
159160
mlc pull repo mlcommons@mlperf-automations --branch=dev
160-
161+
'
161162
- name: Test 14 - add script - Add a new MLC script
162163
run: |
163164
mlc add script my-script-1 --tags=my,new-tags-1
@@ -201,12 +202,13 @@ jobs:
201202
- name: Test 21 - Test mlc pull repo to checkout based on particular release tag
202203
run: |
203204
mlc rm repo mlcommons@mlperf-automations -f
204-
mlc pull repo mlcommons@mlperf-automations --tag=mlperf-automations-v1.0.0
205+
mlc pull repo mlcommons@mlperf-automations --tag=v1.2.0
205206
206207
- name: Test 22 - Test silent mode
207208
run: |
208-
! mlcr detect,cpu -j -s 2>&1 | grep -q INFO
209-
! mlcr detect,cpu -j --silent 2>&1 | grep -q INFO
209+
mlcr detect,cpu -j -s --quiet
210+
! mlcr detect,cpu -j -s --quiet 2>&1 | grep -q INFO
211+
! mlcr detect,cpu -j --silent --quiet 2>&1 | grep -q INFO
210212
211213
- name: Test 23 - Test verbose mode
212214
run: |

CONTRIBUTORS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ Once your contribution exceeds 50 lines of code (in total), we will:
2929
## Current Contributors
3030

3131
- **[Arjun Suresh](https://github.com/arjunsuresh)** - *Initial Development Discussions, {Script,Cache} Action implementations*
32-
- **[Anandhu Sooraj](https://github.com/anandhu-eng)** - *Initial Development Discussions, RepoAction implmentation, Github Tests*
32+
- **[Anandhu Sooraj](https://github.com/anandhu-eng)** - *Initial Development Discussions, RepoAction implementation, Github Tests*
33+
- **[Sujith Kanakkassery](https://github.com/sujik18)** - *Initial Development Discussions, Persistent index implementation*
3334
- **[Shaik Masthan](https://github.com/csemasthan)** - *Initial Development Discussions*
3435
- **[Sahil Avaran](https://github.com/sahilavaran)** - *Initial Development Discussions*, added logging
3536
- **[R.A Sidharth](https://github.com/Sid9993)** - *Find repo implementation*
36-
- **[Sujith Kanakkassery](https://github.com/sujik18)** - *Initial Development Discussions*, adding logging to a file
3737
- **[Your Name Here]** - This could be you! 🎉
3838

3939
---

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.9
1+
1.1.14

mlc/action.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ def is_curdir_inside_path(base_path):
106106
# Iterate through the list of repository paths
107107
for repo_path in repo_paths:
108108
if not os.path.exists(repo_path):
109-
logger.warning(f"""Warning: {repo_path} not found. Considering it as a corrupt entry and deleting automatically...""")
110-
logger.warning(f"Deleting the {meta_yaml_path} entry from repos.json")
109+
logger.warning(f"""Warning: {repo_path} not found. Considering it as a corrupt entry and deleting from repos.json...""")
111110
from .repo_action import rm_repo
112111
res = rm_repo(repo_path, os.path.join(self.repos_path, 'repos.json'), True)
113112

@@ -166,6 +165,10 @@ def load_repos(self):
166165
logger.error(f"Error reading file: {e}")
167166
return None
168167

168+
def get_index(self):
169+
if self._index is None:
170+
self._index = Index(self.repos_path, self.repos)
171+
return self._index
169172

170173
def __init__(self):
171174
setup_logging(log_path=os.getcwd(), log_file='.mlc-log.txt')
@@ -201,7 +204,7 @@ def __init__(self):
201204

202205
self.repos = self.load_repos_and_meta()
203206
#logger.info(f"In Action class: {self.repos_path}")
204-
self.index = Index(self.repos_path, self.repos)
207+
self._index = None
205208

206209

207210
def add(self, i):
@@ -381,7 +384,7 @@ def rm(self, i):
381384

382385
logger.info(f"{target_name} item: {item_path} has been successfully removed")
383386

384-
self.index.rm(item_meta, target_name, item_path)
387+
self.get_index().rm(item_meta, target_name, item_path)
385388

386389
return {
387390
"return": 0,
@@ -414,7 +417,7 @@ def save_new_meta(self, i, item_id, item_name, target_name, item_path, repo):
414417
if save_result["return"] > 0:
415418
return save_result
416419

417-
self.index.add(item_meta, target_name, item_path, repo)
420+
self.get_index().add(item_meta, target_name, item_path, repo)
418421
return {'return': 0}
419422

420423
def update(self, i):
@@ -483,7 +486,7 @@ def update(self, i):
483486
# Save the updated meta back to the item
484487
item.meta = meta
485488
save_result = utils.save_json(item_meta_path, meta=meta)
486-
self.index.update(meta, target_name, item.path, item.repo)
489+
self.get_index().update(meta, target_name, item.path, item.repo)
487490

488491
return {'return': 0, 'message': f"Tags updated successfully for {len(found_items)} item(s).", 'list': found_items }
489492

@@ -642,13 +645,13 @@ def mv(self, run_args):
642645
#Put the src uid to the destination path
643646
dest.meta['uid'] = src.meta['uid']
644647
dest._save_meta()
645-
self.index.update(dest.meta, target_name, dest.path, dest.repo)
648+
self.get_index().update(dest.meta, target_name, dest.path, dest.repo)
646649
logger.info(f"""Item with uid {dest.meta['uid']} successfully moved from {src.path} to {dest.path}""")
647650

648651
return {'return': 0, 'src': src, 'dest': dest}
649652

650653
def search(self, i):
651-
indices = self.index.indices
654+
indices = self.get_index().indices
652655
target = i.get('target_name', self.action_type)
653656
target_index = indices.get(target)
654657
result = []

0 commit comments

Comments
 (0)