-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ODSC-48942]opctl create/publish error on M1 and M2 #381
Changes from all commits
1f18adc
f3f189d
c29bd5d
509a052
32761ee
8535ef1
e16021d
5bc1dc9
65cec58
8a57a5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,6 +241,12 @@ psutil | |
* Source code: https://github.com/giampaolo/psutil | ||
* Project home: https://github.com/giampaolo/psutil | ||
|
||
py-cpuinfo | ||
* Copyright (c) 2014-2022 Matthew Brennan Jones <[email protected]> | ||
* License: The MIT License (MIT) | ||
* Source code: https://github.com/workhorsy/py-cpuinfo | ||
* Project home: https://github.com/workhorsy/py-cpuinfo | ||
|
||
pyspark | ||
* Copyright 2014 and onwards The Apache Software Foundation. | ||
* License: Apache-2.0 LICENSE | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,4 +100,4 @@ RUN rm -rf /tmp/* | |
|
||
RUN mkdir -p /etc/datascience/operators | ||
|
||
USER datascience | ||
USER datascience |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
from subprocess import Popen, PIPE, STDOUT | ||
from typing import Union, List, Tuple, Dict | ||
import yaml | ||
import re | ||
|
||
import ads | ||
from ads.common.oci_client import OCIClientFactory | ||
|
@@ -160,7 +161,14 @@ def build_image( | |
) | ||
proc = _build_custom_operator_image(gpu, source_folder, dst_image) | ||
else: | ||
image, dockerfile, target = _get_image_name_dockerfile_target(image_type, gpu) | ||
# https://stackoverflow.com/questions/66842004/get-the-processor-type-using-python-for-apple-m1-processor-gives-me-an-intel-pro | ||
import cpuinfo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to create a separate function - |
||
# Just get the manufacturer of the processors | ||
manufacturer = cpuinfo.get_cpu_info().get('brand_raw') | ||
arch = 'arm' if re.search("apple m\d ", manufacturer, re.IGNORECASE) else 'other' | ||
print(f"The local machine's platform is {arch}.") | ||
image, dockerfile, target = _get_image_name_dockerfile_target(image_type, gpu, arch) | ||
print(f"dockerfile used is {dockerfile}") | ||
command = [ | ||
"docker", | ||
"build", | ||
|
@@ -186,14 +194,15 @@ def build_image( | |
raise RuntimeError("Docker build failed.") | ||
|
||
|
||
def _get_image_name_dockerfile_target(type: str, gpu: bool) -> str: | ||
def _get_image_name_dockerfile_target(type: str, gpu: bool, arch: str) -> str: | ||
look_up = { | ||
("job-local", False): (ML_JOB_IMAGE, "Dockerfile.job", None), | ||
("job-local", True): (ML_JOB_GPU_IMAGE, "Dockerfile.job.gpu", None), | ||
("ads-ops-base", False): (OPS_IMAGE_BASE, "Dockerfile", "base"), | ||
("ads-ops-base", True): (OPS_IMAGE_GPU_BASE, "Dockerfile.gpu", "base"), | ||
("job-local", False, "arm"): (ML_JOB_IMAGE, "Dockerfile.job.arm", None), | ||
("job-local", False, "other"): (ML_JOB_IMAGE, "Dockerfile.job", None), | ||
("job-local", True, "other"): (ML_JOB_GPU_IMAGE, "Dockerfile.job.gpu", None), | ||
("ads-ops-base", False, "other"): (OPS_IMAGE_BASE, "Dockerfile", "base"), | ||
("ads-ops-base", True, "other"): (OPS_IMAGE_GPU_BASE, "Dockerfile.gpu", "base"), | ||
} | ||
return look_up[(type, gpu)] | ||
return look_up[(type, gpu, arch)] | ||
|
||
|
||
@runtime_dependency(module="docker", install_from=OptionalDependency.OPCTL) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,7 @@ opctl = [ | |
"nbconvert", | ||
"nbformat", | ||
"oci-cli", | ||
"py-cpuinfo", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New library will need an input into https://github.com/oracle/accelerated-data-science/blob/main/THIRD_PARTY_LICENSES.txt |
||
] | ||
optuna = [ | ||
"optuna==2.9.0", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use logger for debug purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember we could only use print() to show the msgs when running this code in container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep yep, you are right.