Skip to content

Commit bf51ba3

Browse files
authored
Merge pull request #181 from GATEOverflow/dev
Added support for mlcd, mlce and mlcp shortcuts
2 parents 48a30fe + adefe33 commit bf51ba3

File tree

4 files changed

+50
-14
lines changed

4 files changed

+50
-14
lines changed

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

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ jobs:
206206
- name: Test 22 - Test recursive mlc pull repo
207207
run: |
208208
export MLC_REPOS=$HOME/test
209-
mlc pull repo https://github.com/GATEOverflow/GO-PDFs
209+
mlcp https://github.com/GATEOverflow/GO-PDFs
210210
mlcr detect,os -j
211211
212212
test_mlc_access_core_actions:
@@ -271,9 +271,6 @@ jobs:
271271
matrix:
272272
python-version: ["3.12", "3.8"]
273273
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
274-
exclude:
275-
- os: windows-latest
276-
- os: macos-latest
277274

278275
steps:
279276
- uses: actions/checkout@v4
@@ -352,8 +349,34 @@ jobs:
352349
mlc rm cache -h
353350
mlc search cache -h
354351
mlc show cache -h
355-
- name: MLC doc script
352+
353+
test_mlc_script_actions:
354+
runs-on: ${{ matrix.os }}
355+
strategy:
356+
fail-fast: false
357+
matrix:
358+
python-version: ["3.13", "3.8"]
359+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
360+
action: ["mlcr", "mlce", "mlct"]
361+
362+
steps:
363+
- uses: actions/checkout@v4
364+
- name: Set up Python ${{ matrix.python-version }}
365+
uses: actions/setup-python@v3
366+
with:
367+
python-version: ${{ matrix.python-version }}
368+
369+
- name: Configure git longpaths (Windows)
370+
if: matrix.os == 'windows-latest'
371+
run: |
372+
git config --system core.longpaths true
373+
374+
- name: Install mlcflow from the pull request's source repository and branch
375+
run: |
376+
python -m pip install --upgrade pip
377+
python -m pip install --ignore-installed --verbose pip setuptools
378+
python -m pip install .
379+
- name: MLC ${{matrix.action}} script
356380
run: |
357-
mlc pull repo mlcommons@mlperf-automations
358-
mlc doc script --tags=detect,cpu
359-
mlc doc script --all
381+
mlcp mlcommons@mlperf-automations
382+
${{matrix.action}} detect,cpu

.github/workflows/test-mlc-docker-core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
5757
- name: Test --docker_cache
5858
run: |
59-
mlc docker run --tags=detect,os --docker_dt --docker_cache=no
59+
mlcd detect,os --docker_dt --docker_cache=no
6060
6161
- name: Test --docker_rebuild
6262
run: |

mlc/main.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,26 @@ def search(self, i):
7575
#indices
7676

7777

78-
def mlcr():
79-
first_arg_value = "run"
80-
second_arg_value = "script"
78+
def mlc_expand_short(action, target = "script"):
8179

8280
# Insert the positional argument into sys.argv for the main function
83-
sys.argv.insert(1, first_arg_value)
84-
sys.argv.insert(2, second_arg_value)
81+
sys.argv.insert(1, action)
82+
sys.argv.insert(2, target)
8583

8684
# Call the main function
8785
main()
8886

87+
def mlcr():
88+
mlc_expand_short("run")
89+
def mlcd():
90+
mlc_expand_short("docker")
91+
def mlce():
92+
mlc_expand_short("experiment")
93+
def mlct():
94+
mlc_expand_short("test")
95+
96+
def mlcp():
97+
mlc_expand_short("pull", "repo")
8998

9099

91100
def process_console_output(res, target, action, run_args):

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ py-modules = []
4747
[project.scripts]
4848
mlc = "mlc.main:main"
4949
mlcr = "mlc.main:mlcr"
50+
mlcd = "mlc.main:mlcd"
51+
mlce = "mlc.main:mlce"
52+
mlct = "mlc.main:mlct"
53+
mlcp = "mlc.main:mlcp"

0 commit comments

Comments
 (0)