IBM Watson Studio provides you with the environment and tools to solve your business problems by collaboratively working with data.

This blog post is a follow-up to my previous post, “How to Access Watson Studio Assets by API.” In that article, I showed you how to retrieve an access token and access Watson Studio assets via API from the command line. 

One useful scenario is to use this method to cancel a running job scheduled from IBM Watson Studio. It’s quite common for users to schedule a job with a Python Notebook from Watson Studio. In rare cases, users are not able to delete the job from the web console, so I’m going to detail a way to delete the job via the command line.

Step-by-step instructions

  1. Get the access token by following the instructions in “How to Access Watson Studio Assets by API.”
  2. Find the asset_id of the running job from the web console. To find it, we’ll need to use the Developer Tool provided in the Google Chrome browser. To get the job-run’s asset_id, go to the Job Details page, inspect network, and search for “runs”. The asset_id can be found in the metadata field:
  3. Once you have the asset_id, use the following command to verify the details of the running job:
    project_id="<project id>"
    end_point="https://api.dataplatform.cloud.ibm.com"
    asset_id="<asset id>"
    
    curl -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H "$(cat wml_token.txt)" \
    -X GET "${end_point}/v2/assets/${asset_id}?project_id=${project_id}"

    It’s a good idea to save the command into a script for future use. Please refer to the instructions in “How to Access Watson Studio Assets by API” to get the details of an asset. Sample output:

  4. Once you’ve confirmed the job details, you can cancel the job by deleting the asset with the following command:
    curl -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H "$(cat wml_token.txt)" \
    -X DELETE "${end_point}/v2/assets/${asset_id}?project_id=${project_id}"

By now, the run job should have been cancelled.

Summary

The Watson Data API provides a comprehensive list of functions to manage the assets, and most GUI interface-based functions can also be implemented with the API command line. However, in some cases, users have to use the API to manage certain task, as demonstrated in this post.

You can also follow these guidelines to access other assets in Watson Studio, such as projects, catalogs, buckets, etc. For further information on the API, please refer to the online documentation at IBM Watson Data API.

Categories

More from Cloud

Kubernetes version 1.28 now available in IBM Cloud Kubernetes Service

2 min read - We are excited to announce the availability of Kubernetes version 1.28 for your clusters that are running in IBM Cloud Kubernetes Service. This is our 23rd release of Kubernetes. With our Kubernetes service, you can easily upgrade your clusters without the need for deep Kubernetes knowledge. When you deploy new clusters, the default Kubernetes version remains 1.27 (soon to be 1.28); you can also choose to immediately deploy version 1.28. Learn more about deploying clusters here. Kubernetes version 1.28 In…

Temenos brings innovative payments capabilities to IBM Cloud to help banks transform

3 min read - The payments ecosystem is at an inflection point for transformation, and we believe now is the time for change. As banks look to modernize their payments journeys, Temenos Payments Hub has become the first dedicated payments solution to deliver innovative payments capabilities on the IBM Cloud for Financial Services®—an industry-specific platform designed to accelerate financial institutions' digital transformations with security at the forefront. This is the latest initiative in our long history together helping clients transform. With the Temenos Payments…

Foundational models at the edge

7 min read - Foundational models (FMs) are marking the beginning of a new era in machine learning (ML) and artificial intelligence (AI), which is leading to faster development of AI that can be adapted to a wide range of downstream tasks and fine-tuned for an array of applications.  With the increasing importance of processing data where work is being performed, serving AI models at the enterprise edge enables near-real-time predictions, while abiding by data sovereignty and privacy requirements. By combining the IBM watsonx data…

The next wave of payments modernization: Minimizing complexity to elevate customer experience

3 min read - The payments ecosystem is at an inflection point for transformation, especially as we see the rise of disruptive digital entrants who are introducing new payment methods, such as cryptocurrency and central bank digital currencies (CDBC). With more choices for customers, capturing share of wallet is becoming more competitive for traditional banks. This is just one of many examples that show how the payments space has evolved. At the same time, we are increasingly seeing regulators more closely monitor the industry’s…