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.

Was this article helpful?
YesNo

More from Cloud

How a US bank modernized its mainframe applications with IBM Consulting and Microsoft Azure

9 min read - As organizations strive to stay ahead of the curve in today's fast-paced digital landscape, mainframe application modernization has emerged as a critical component of any digital transformation strategy. In this blog, we'll discuss the example of a fictional US bank which embarked on a journey to modernize its mainframe applications. This strategic project has helped it to transform into a more modern, flexible and agile business. In looking at the ways in which it approached the problem, you’ll gain insights…

Attention new clients: exciting financial incentives for VMware Cloud Foundation on IBM Cloud

4 min read - New client specials: Get up to 50% off when you commit to a 1- or 3-year term contract on new VCF-as-a-Service offerings, plus an additional value of up to USD 200K in credits through 30 June 2025 when you migrate your VMware workloads to IBM Cloud®.1 Low starting prices: On-demand VCF-as-a-Service deployments begin under USD 200 per month.2 The IBM Cloud benefit: See the potential for a 201%3 return on investment (ROI) over 3 years with reduced downtime, cost and…

24 IBM offerings winning TrustRadius 2024 Top Rated Awards

2 min read - TrustRadius is a buyer intelligence platform for business technology. Comprehensive product information, in-depth customer insights and peer conversations enable buyers to make confident decisions. “Earning a Top Rated Award means the vendor has excellent customer satisfaction and proven credibility. It’s based entirely on reviews and customer sentiment,” said Becky Susko, TrustRadius, Marketing Program Manager of Awards. Top Rated Awards have to be earned: Gain 10+ new reviews in the past 12 months Earn a trScore of 7.5 or higher from…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters