forked from mlcommons/cm4mlops
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from arjunsuresh/mlperf-inference
Support get, docker
- Loading branch information
Showing
11 changed files
with
158 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from cmind import utils | ||
import os | ||
|
||
def preprocess(i): | ||
|
||
os_info = i['os_info'] | ||
|
||
env = i['env'] | ||
|
||
automation = i['automation'] | ||
|
||
recursion_spaces = i['recursion_spaces'] | ||
|
||
file_name = 'docker.exe' if os_info['platform'] == 'windows' else 'docker' | ||
env['FILE_NAME'] = file_name | ||
|
||
if 'CM_DOCKER_BIN_WITH_PATH' not in env: | ||
r = i['automation'].find_artifact({'file_name': file_name, | ||
'env': env, | ||
'os_info':os_info, | ||
'default_path_env_key': 'PATH', | ||
'detect_version':True, | ||
'env_path_key':'CM_DOCKER_BIN_WITH_PATH', | ||
'run_script_input':i['run_script_input'], | ||
'recursion_spaces':recursion_spaces}) | ||
if r['return'] >0 : | ||
if r['return'] == 16: | ||
run_file_name = "install" | ||
r = automation.run_native_script({'run_script_input':i['run_script_input'], 'env':env, 'script_name':run_file_name}) | ||
if r['return'] >0: return r | ||
else: | ||
return r | ||
|
||
return {'return':0} | ||
|
||
def detect_version(i): | ||
r = i['automation'].parse_version({'match_text': r'Docker version\s*([\d.]+)', | ||
'group_number': 1, | ||
'env_key':'CM_DOCKER_VERSION', | ||
'which_env':i['env']}) | ||
if r['return'] >0: return r | ||
|
||
version = r['version'] | ||
|
||
print (i['recursion_spaces'] + ' Detected version: {}'.format(version)) | ||
return {'return':0, 'version':version} | ||
|
||
def postprocess(i): | ||
env = i['env'] | ||
|
||
r = detect_version(i) | ||
|
||
if r['return'] >0: return r | ||
|
||
version = r['version'] | ||
found_file_path = env['CM_DOCKER_BIN_WITH_PATH'] | ||
|
||
found_path = os.path.dirname(found_file_path) | ||
env['CM_DOCKER_INSTALLED_PATH'] = found_path | ||
env['+PATH'] = [ found_path ] | ||
|
||
env['CM_DOCKER_CACHE_TAGS'] = 'version-'+version | ||
|
||
return {'return':0, 'version': version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
sudo yum install -y yum-utils | ||
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | ||
|
||
cmd="sudo usermod -aG docker $USER" | ||
echo "$cmd" | ||
eval "$cmd" | ||
test $? -eq 0 || exit $? | ||
|
||
echo "Please relogin to the shell so that the new group is effective" | ||
exit 1 | ||
#exec newgrp docker | ||
#sudo su - $USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
echo "Please install docker to continue" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
echo "Please install docker to continue" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
docker --version > tmp-ver.out | ||
test $? -eq 0 || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters