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

Fortressing the digital frontier: A comprehensive look at IBM Cloud network security services

6 min read - The cloud revolution has fundamentally transformed how businesses operate. Its superior scalability, agility and cost-effectiveness have made it the go-to platform for organizations of all sizes. However, this shift to the cloud has introduced a new landscape of ever-evolving security threats. Data breaches and cyberattacks continue to hit organizations, making robust cloud network security an absolute necessity. IBM®, a titan in the tech industry, recognizes this critical need, provides a comprehensive suite of tools and offers unmatched expertise to fortify…

How well do you know your hypervisor and firmware?

6 min read - IBM Cloud® Virtual Private Cloud (VPC) is designed for secured cloud computing, and several features of our platform planning, development and operations help ensure that design. However, because security in the cloud is typically a shared responsibility between the cloud service provider and the customer, it’s essential for you to fully understand the layers of security that your workloads run on here with us. That’s why here, we detail a few key security components of IBM Cloud VPC that aim…

New IBM study: How business leaders can harness the power of gen AI to drive sustainable IT transformation

3 min read - As organizations strive to balance productivity, innovation and environmental responsibility, the need for sustainable IT practices is even more pressing. A new global study from the IBM Institute for Business Value reveals that emerging technologies, particularly generative AI, can play a pivotal role in advancing sustainable IT initiatives. However, successful transformation of IT systems demands a strategic and enterprise-wide approach to sustainability. The power of generative AI in sustainable IT Generative AI is creating new opportunities to transform IT operations…

IBM Newsletters

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