Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/test-mlc-core-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: MLC core actions test

on:
pull_request:
branches: [ "main", "dev" ]
paths:
- '.github/workflows/test-mlc-core-actions.yml'
- '**'
- '!**.md'

jobs:
test_mlc_core_actions:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.8"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Configure git longpaths (Windows)
if: matrix.os == 'windows-latest'
run: |
git config --system core.longpaths true

- name: Install mlcflow from the pull request's source repository and branch
run: |
python -m pip install --upgrade pip
python -m pip install --ignore-installed --verbose pip setuptools
python -m pip install .

- name: Test pull repo - Pull a forked MLOps repository
run: |
mlc pull repo anandhu-eng@mlperf-automations --checkout=dev

- name: Test pull repo - Test conflicting repo scenario
run: |
mlc pull repo mlcommons@mlperf-automations --checkout=dev

- name: Test list repo - List the existing repositories
run: |
mlc list repo

- name: Test rm repo - Remove the forked mlperf-automation repo
run: |
mlc rm repo anandhu-eng@mlperf-automations

- name: Test find cache - Cache not present
run: |
mlc find cache --tags=detect,os

- name: Test run script - Output being used for testing mlc cache
run: |
mlc run script --tags=get,imagenet-aux
mlc run script --tags=get,imagenet-aux,_from.dropbox

- name: Test find cache - More than one cache present
run: |
mlc find cache --tags=get,imagenet-aux
22 changes: 20 additions & 2 deletions mlc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ def call_script_module_function(self, function_name, run_args):
return result
else:
logger.info("ScriptAutomation class not found in the script.")
return {'return': 1, 'error': 'ScriptAutomation class not found in the script.'}

def docker(self, run_args):
return self.call_script_module_function("docker", run_args)
Expand Down Expand Up @@ -1111,10 +1112,23 @@ def find(self, run_args):
#logger.info(f"Running script with identifier: {args.details}")
# The REPOS folder is set by the user, for example via an environment variable.
#logger.info(f"In cache action {repos_folder}")

run_args['target_name'] = "cache"
#print(f"run_args = {run_args}")
return self.search(run_args)
res = self.search(run_args)
if res['return'] > 0:
return res
else:
if not res['list']:
logger.warning("No cache entry found for the specified tags!")
return {'return': 0, 'list': []}
else:
logger.info("Listing all cache entries found for the specified tags.")
print("Cache entries:")
print("-------------")
for cache_entry in res['list']:
print(f"- {cache_entry.path}\n")
print("-------------")
return {"return": 0, 'list': res['list']}

def list(self, args):
logger.info("Listing all caches.")
Expand Down Expand Up @@ -1252,6 +1266,10 @@ def main():
if hasattr(args, 'repo') and args.repo:
run_args['repo'] = args.repo

if args.command in ['rm']:
if args.target == "repo":
run_args['repo'] = args.details

if args.command in ["cp", "mv"]:
run_args['target'] = args.target
if hasattr(args, 'details') and args.details:
Expand Down
Loading