<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: CML API call to start the AIML job in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/CML-API-call-to-start-the-AIML-job/m-p/399545#M250509</link>
    <description>&lt;P&gt;&lt;SPAN&gt;1) When is V1 getting depreciated?&lt;BR /&gt;it is already&lt;BR /&gt;&lt;A href="https://docs.cloudera.com/machine-learning/cloud/jobs-pipelines/topics/ml-rest-apis.html" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/machine-learning/cloud/jobs-pipelines/topics/ml-rest-apis.html&lt;/A&gt;&lt;BR /&gt;--&lt;BR /&gt;The Jobs API is now deprecated. See&amp;nbsp;&lt;SPAN class="ph"&gt;Cloudera AI&lt;/SPAN&gt;&amp;nbsp;API v2&amp;nbsp;and&amp;nbsp;&lt;EM&gt;API v2 usage&lt;/EM&gt;&amp;nbsp;for the successor API.&lt;BR /&gt;--&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;Is it recommended to use V1 API now?&amp;nbsp;&lt;BR /&gt;Obviously, No.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;2) Which API method is to be used in the Version 2 API call to start the job?&lt;BR /&gt;&lt;A href="https://docs.cloudera.com/machine-learning/1.5.4/rest-api-reference/index.html#api-CMLService-createJobRun" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/machine-learning/1.5.4/rest-api-reference/index.html#api-CMLService-createJobRun&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;may be createjob, createjobrun are confusing&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2025 13:15:09 GMT</pubDate>
    <dc:creator>Gopinath</dc:creator>
    <dc:date>2025-01-03T13:15:09Z</dc:date>
    <item>
      <title>CML API call to start the AIML job</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CML-API-call-to-start-the-AIML-job/m-p/398904#M250335</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;Good Day&lt;/P&gt;&lt;P&gt;We have a requirement to start the CDSW AI ML job from the API call. We&amp;nbsp;are currently using &lt;STRONG&gt;Cloudera Machine Learning&amp;nbsp;legacy REST API&amp;nbsp;(Version V1)&lt;/STRONG&gt; as per this link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.cloudera.com/machine-learning/1.5.4/jobs-pipelines/topics/ml-rest-apis.html" target="_blank"&gt;https://docs.cloudera.com/machine-learning/1.5.4/jobs-pipelines/topics/ml-rest-apis.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;curl -v -XPOST &lt;A href="http://cdsw.example.com/api/v1/%3cpath_to_job" target="_blank"&gt;http://cdsw.example.com/api/v1/&amp;lt;path_to_job&lt;/A&gt;&amp;gt; --user "&amp;lt;LEGACY_API_KEY&amp;gt;:"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Ex: curl -XPOST &lt;A href="https://***/api/v1/projects/bd***/s***/jobs/2/start" target="_blank"&gt;https://***/api/v1/projects/bd***/s***/jobs/2/start&lt;/A&gt;&amp;nbsp; --user "***" --header "Content-type: application/json" --data "{}"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We are working to upgrade the CDSW to CML and as part of this job rewrite exercise we also thought to use&amp;nbsp;&lt;STRONG&gt;Cloudera Machine Learning REST API v2 (Version V2)&lt;/STRONG&gt; for the&amp;nbsp;&lt;STRONG&gt;curl command to Start the Job&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In the below URL, We don't see a method to start the job&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.cloudera.com/machine-learning/1.5.4/rest-api-reference/index.html#examples-CMLService-restartApplication-0-python" target="_blank"&gt;https://docs.cloudera.com/machine-learning/1.5.4/rest-api-reference/index.html#examples-CMLService-restartApplication-0-python&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please share your expertise on the below open queries :&lt;/P&gt;&lt;P&gt;1) When is V1 getting depreciated? Is it recommended to use V1 API now?&lt;/P&gt;&lt;P&gt;2) Which API method is to be used in the Version 2 API call to start the job?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2026 06:22:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CML-API-call-to-start-the-AIML-job/m-p/398904#M250335</guid>
      <dc:creator>NagendraKumar</dc:creator>
      <dc:date>2026-04-21T06:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: CML API call to start the AIML job</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CML-API-call-to-start-the-AIML-job/m-p/399545#M250509</link>
      <description>&lt;P&gt;&lt;SPAN&gt;1) When is V1 getting depreciated?&lt;BR /&gt;it is already&lt;BR /&gt;&lt;A href="https://docs.cloudera.com/machine-learning/cloud/jobs-pipelines/topics/ml-rest-apis.html" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/machine-learning/cloud/jobs-pipelines/topics/ml-rest-apis.html&lt;/A&gt;&lt;BR /&gt;--&lt;BR /&gt;The Jobs API is now deprecated. See&amp;nbsp;&lt;SPAN class="ph"&gt;Cloudera AI&lt;/SPAN&gt;&amp;nbsp;API v2&amp;nbsp;and&amp;nbsp;&lt;EM&gt;API v2 usage&lt;/EM&gt;&amp;nbsp;for the successor API.&lt;BR /&gt;--&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;Is it recommended to use V1 API now?&amp;nbsp;&lt;BR /&gt;Obviously, No.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;2) Which API method is to be used in the Version 2 API call to start the job?&lt;BR /&gt;&lt;A href="https://docs.cloudera.com/machine-learning/1.5.4/rest-api-reference/index.html#api-CMLService-createJobRun" target="_blank" rel="noopener"&gt;https://docs.cloudera.com/machine-learning/1.5.4/rest-api-reference/index.html#api-CMLService-createJobRun&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;may be createjob, createjobrun are confusing&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 13:15:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CML-API-call-to-start-the-AIML-job/m-p/399545#M250509</guid>
      <dc:creator>Gopinath</dc:creator>
      <dc:date>2025-01-03T13:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: CML API call to start the AIML job</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CML-API-call-to-start-the-AIML-job/m-p/399719#M250537</link>
      <description>&lt;P&gt;You can find the Docs for Python and API by going to User Settings -&amp;gt; API Keys&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2025-01-06 a la(s) 5.55.15 p.m..png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/43358iCBEDABBDC49A9C49/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2025-01-06 a la(s) 5.55.15 p.m..png" alt="Captura de pantalla 2025-01-06 a la(s) 5.55.15 p.m..png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;From the Python CML APIv2 Docs, these are the two methods you need:&lt;/P&gt;&lt;P&gt;Step 1: Create Job&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from __future__ import print_function
import time
import cmlapi
from cmlapi.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = cmlapi.CMLServiceApi()
body = cmlapi.CreateJobRequest() # CreateJobRequest |
project_id = 'project_id_example' # str | ID of the project containing the job.

try:
  # Create a new job.
  api_response = api_instance.create_job(body, project_id)
  pprint(api_response)
except ApiException as e:
  print("Exception when calling CMLServiceApi-&amp;gt;create_job: %s\n" % e)&lt;/LI-CODE&gt;&lt;P&gt;Step 2: Run the Job&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from __future__ import print_function
import time
import cmlapi
from cmlapi.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = cmlapi.CMLServiceApi()
body = cmlapi.CreateJobRunRequest() # CreateJobRunRequest | 
project_id = 'project_id_example' # str | ID of the project containing the job.
job_id = 'job_id_example' # str | The job ID to create a new job run for.

try:
    # Create and start a new job run for a job.
    api_response = api_instance.create_job_run(body, project_id, job_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CMLServiceApi-&amp;gt;create_job_run: %s\n" % e)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the "cmlapi.CreateJobRequest()" or "cmlapi.CreateJobRunRequest()" methods can be tricky. Here's an advanced example:&amp;nbsp;&lt;A href="https://github.com/pdefusco/SparkGen/blob/main/autogen/cml_orchestrator.py" target="_self"&gt;https://github.com/pdefusco/SparkGen/blob/main/autogen/cml_orchestrator.py&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In particular:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sparkgen_1_job_body = cmlapi.CreateJobRequest(
    project_id = project_id,
    name = "SPARKGEN_1_"+session_id,
    script = "autogen/cml_sparkjob_1.py",
    cpu = 4.0,
    memory = 8.0,
    runtime_identifier = "docker.repository.cloudera.com/cloudera/cdsw/ml-runtime-workbench-python3.7-standard:2023.05.1-b4",
    runtime_addon_identifiers = ["spark320-18-hf4"],
    environment = {
                    "x":str(x),
                    "y":str(y),
                    "z":str(z),
                    "ROW_COUNT_car_installs":str(ROW_COUNT_car_installs),
                    "UNIQUE_VALS_car_installs":str(UNIQUE_VALS_car_installs),
                    "PARTITIONS_NUM_car_installs":str(PARTITIONS_NUM_car_installs),
                    "ROW_COUNT_car_sales":str(ROW_COUNT_car_sales),
                    "UNIQUE_VALS_car_sales":str(UNIQUE_VALS_car_sales),
                    "PARTITIONS_NUM_car_sales":str(PARTITIONS_NUM_car_sales),
                    "ROW_COUNT_customer_data":str(ROW_COUNT_customer_data),
                    "UNIQUE_VALS_customer_data":str(UNIQUE_VALS_customer_data),
                    "PARTITIONS_NUM_customer_data":str(PARTITIONS_NUM_customer_data),
                    "ROW_COUNT_factory_data":str(ROW_COUNT_factory_data),
                    "UNIQUE_VALS_factory_data":str(UNIQUE_VALS_factory_data),
                    "PARTITIONS_NUM_factory_data":str(PARTITIONS_NUM_factory_data),
                    "ROW_COUNT_geo_data":str(ROW_COUNT_geo_data),
                    "UNIQUE_VALS_geo_data":str(UNIQUE_VALS_geo_data),
                    "PARTITIONS_NUM_geo_data":str(PARTITIONS_NUM_geo_data)
                    }
)
sparkgen_1_job = client.create_job(sparkgen_1_job_body, project_id)&lt;/LI-CODE&gt;&lt;P&gt;And&lt;/P&gt;&lt;LI-CODE lang="python"&gt;jobrun_body = cmlapi.CreateJobRunRequest(project_id, sparkgen_1_job.id)
job_run = client.create_job_run(jobrun_body, project_id, sparkgen_1_job.id)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 02:01:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CML-API-call-to-start-the-AIML-job/m-p/399719#M250537</guid>
      <dc:creator>pauldefusco</dc:creator>
      <dc:date>2025-01-07T02:01:53Z</dc:date>
    </item>
  </channel>
</rss>

