Skip to content
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

Update Watson Machine Learning auth with IAM #1737

Merged
merged 2 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def get_secret_creds(path):
wml_username = get_secret_creds("/app/secrets/wml_username")
wml_password = get_secret_creds("/app/secrets/wml_password")
wml_instance_id = get_secret_creds("/app/secrets/wml_instance_id")
wml_apikey = get_secret_creds("/app/secrets/wml_apikey")
cos_endpoint = get_secret_creds("/app/secrets/cos_endpoint")
cos_access_key = get_secret_creds("/app/secrets/cos_access_key")
cos_secret_key = get_secret_creds("/app/secrets/cos_secret_key")
Expand All @@ -52,7 +53,8 @@ def get_secret_creds(path):
"url": wml_url,
"username": wml_username,
"password": wml_password,
"instance_id": wml_instance_id
"instance_id": wml_instance_id,
"apikey": wml_apikey
}
''' Load Spark model '''
cos = Minio(cos_endpoint,
Expand Down
4 changes: 3 additions & 1 deletion components/ibm-components/watson/deploy/src/wml-deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ def deploy(args):
wml_username = getSecret("/app/secrets/wml_username")
wml_password = getSecret("/app/secrets/wml_password")
wml_instance_id = getSecret("/app/secrets/wml_instance_id")
wml_apikey = getSecret("/app/secrets/wml_apikey")

# set up the WML client
wml_credentials = {
"url": wml_url,
"username": wml_username,
"password": wml_password,
"instance_id": wml_instance_id
"instance_id": wml_instance_id,
"apikey": wml_apikey
}
client = WatsonMachineLearningAPIClient(wml_credentials)

Expand Down
10 changes: 6 additions & 4 deletions components/ibm-components/watson/store/src/wml-store.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# define the function to store the model

def getSecret(secret):
Expand All @@ -26,16 +26,18 @@ def store(wml_model_name, run_uid):
wml_username = getSecret("/app/secrets/wml_username")
wml_password = getSecret("/app/secrets/wml_password")
wml_instance_id = getSecret("/app/secrets/wml_instance_id")

wml_apikey = getSecret("/app/secrets/wml_apikey")

# set up the WML client
wml_credentials = {
"url": wml_url,
"username": wml_username,
"password": wml_password,
"instance_id": wml_instance_id
"instance_id": wml_instance_id,
"apikey": wml_apikey
}
client = WatsonMachineLearningAPIClient( wml_credentials )

# store the model
stored_model_name = wml_model_name
stored_model_details = client.repository.store_model( run_uid, stored_model_name )
Expand Down
4 changes: 3 additions & 1 deletion components/ibm-components/watson/train/src/wml-train.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def train(args):
wml_url = getSecret("/app/secrets/wml_url")
wml_username = getSecret("/app/secrets/wml_username")
wml_password = getSecret("/app/secrets/wml_password")
wml_apikey = getSecret("/app/secrets/wml_apikey")
wml_instance_id = getSecret("/app/secrets/wml_instance_id")

wml_data_source_type = getSecret("/app/secrets/wml_data_source_type")
Expand Down Expand Up @@ -68,7 +69,8 @@ def train(args):
"url": wml_url,
"username": wml_username,
"password": wml_password,
"instance_id": wml_instance_id
"instance_id": wml_instance_id,
"apikey": wml_apikey
}
client = WatsonMachineLearningAPIClient( wml_credentials )

Expand Down
2 changes: 1 addition & 1 deletion samples/contrib/ibm-samples/watson/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To provision your own Watson Machine Learning services and cloud object store, f

To create a machine learning service, go to [IBM Cloud](https://console.bluemix.net), login with IBM account id first. From the `Catalog` page, click on `AI` tab on the left side to go to this [page](https://console.bluemix.net/catalog/?category=ai). Then click on the [`Machine Learning`](https://console.bluemix.net/catalog/services/machine-learning) link and follow the instructions to create the service.

Once the service is created, from service's `Dashboard`, follow the instruction to generate `service credentials`. Refer to IBM Cloud [documents](https://console.bluemix.net/docs/) for help if needed. Collect the `url`, `username`, `password` and `instance_id` info from the service credentials as these will be required to access the service.
Once the service is created, from service's `Dashboard`, follow the instruction to generate `service credentials`. Refer to IBM Cloud [documents](https://console.bluemix.net/docs/) for help if needed. Collect the `url`, `username`, `password`, `apikey`, and `instance_id` info from the service credentials as these will be required to access the service.

* A cloud object store

Expand Down
1 change: 1 addition & 0 deletions samples/contrib/ibm-samples/watson/credentials/creds.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ wml_url=https://us-south.ml.cloud.ibm.com
wml_username=WMLUserName
wml_password=WMLPassword
wml_instance_id=WMLInstanceId
wml_apikey=WMLAPIKey

wml_data_source_type=s3

Expand Down