doc-exports/docs/modelarts/sdk-ref/modelarts_04_0166.html
Lai, Weijian eda19245f1 modelarts sdk-ref version 21.430 update
Reviewed-by: Jiang, Beibei <beibei.jiang@t-systems.com>
Reviewed-by: Rechenburg, Matthias <matthias.rechenburg@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2023-03-20 09:32:27 +00:00

97 lines
10 KiB
HTML

<a name="modelarts_04_0166"></a><a name="modelarts_04_0166"></a>
<h1 class="topictitle1">Deleting a Training Job</h1>
<div id="body8662426"><div class="section" id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_section20261580353"><h4 class="sectiontitle">Sample Code</h4><p id="modelarts_04_0166__en-us_topic_0180094058_p730511113430">In the ModelArts notebook instance, you do not need to enter authentication parameters for session authentication. For details about session authentication of other development environments, see <a href="modelarts_04_0123.html">Session Authentication</a>.</p>
<div class="p" id="modelarts_04_0166__en-us_topic_0180094058_p1156162203815">Method 1: Delete a training job based on the specified <strong id="modelarts_04_0166__en-us_topic_0180094058_b15318121114482">job_id</strong>.<div class="codecoloring" codetype="Python" id="modelarts_04_0166__en-us_topic_0180094058_screen735412413136"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><span class="kn">from</span> <span class="nn">modelarts.session</span> <span class="kn">import</span> <span class="n">Session</span>
<span class="kn">from</span> <span class="nn">modelarts.estimator</span> <span class="kn">import</span> <span class="n">Estimator</span>
<span class="n">session</span> <span class="o">=</span> <span class="n">Session</span><span class="p">()</span>
<span class="n">Estimator</span><span class="o">.</span><span class="n">delete_job_by_id</span><span class="p">(</span><span class="n">modelarts_session</span><span class="o">=</span><span class="n">session</span><span class="p">,</span> <span class="n">job_id</span><span class="o">=</span><span class="s2">&quot;155500&quot;</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
</div>
<p id="modelarts_04_0166__en-us_topic_0180094058_p24321849184314">Method 2: Delete the training job created in <a href="modelarts_04_0131.html">Creating a Training Job</a>.</p>
<div class="codecoloring" codetype="Python" id="modelarts_04_0166__en-us_topic_0180094058_screen1130525115134"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">status</span> <span class="o">=</span> <span class="n">job_instance</span><span class="o">.</span><span class="n">delete_job</span><span class="p">()</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_section3889526413"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_table155461191218" frame="border" border="1" rules="all"><caption><b>Table 1 </b><strong id="modelarts_04_0166__en-us_topic_0180094058_b636424812484">delete_job_by_id</strong> request parameters</caption><thead align="left"><tr id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_row254817912212"><th align="left" class="cellrowborder" valign="top" width="22.75%" id="mcps1.3.2.2.2.5.1.1"><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p12549899214">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.879999999999999%" id="mcps1.3.2.2.2.5.1.2"><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p3552101193813">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.34%" id="mcps1.3.2.2.2.5.1.3"><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p1755169172118">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54.03%" id="mcps1.3.2.2.2.5.1.4"><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p55521998211">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_row8893215413"><td class="cellrowborder" valign="top" width="22.75%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p6891421842">modelarts_session</p>
</td>
<td class="cellrowborder" valign="top" width="9.879999999999999%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p68972047">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.34%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p158912219419">Object</p>
</td>
<td class="cellrowborder" valign="top" width="54.03%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p1689152543">Session object. For details about the initialization method, see <a href="modelarts_04_0123.html">Session Authentication</a>.</p>
</td>
</tr>
<tr id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_row1530181931"><td class="cellrowborder" valign="top" width="22.75%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p117415916499">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="9.879999999999999%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p6675978319">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.34%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p46751171339">String</p>
</td>
<td class="cellrowborder" valign="top" width="54.03%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p467516712319">ID of a training job. You can query <strong id="modelarts_04_0166__en-us_topic_0180094058_b795042164510">job_id</strong> using the training job object generated in <a href="modelarts_04_0131.html">Creating a Training Job</a>, for example, <span class="filepath" id="modelarts_04_0166__en-us_topic_0180094058_filepath119515214513"><b>job_instance.job_id</b></span>, or from the response obtained in <a href="modelarts_04_0160.html">Obtaining Training Jobs</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_table1221422915578" frame="border" border="1" rules="all"><caption><b>Table 2 </b><strong id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_b1082121233116">delete_job_by_id</strong> response parameters</caption><thead align="left"><tr id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_row6616560815578"><th align="left" class="cellrowborder" valign="top" width="26.02%" id="mcps1.3.2.3.2.4.1.1"><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p39128198155725">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35.980000000000004%" id="mcps1.3.2.3.2.4.1.2"><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p28702598155725">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="38%" id="mcps1.3.2.3.2.4.1.3"><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p43209091155725">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_row1757872301417"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p1358132391416">error_msg</p>
</td>
<td class="cellrowborder" valign="top" width="35.980000000000004%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p11581182310140">String</p>
</td>
<td class="cellrowborder" valign="top" width="38%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p202911533131416">Error message when the API call fails.</p>
<p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p729215339148">This parameter is not included when the API call succeeds.</p>
</td>
</tr>
<tr id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_row4566967315578"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p25254004155725">error_code</p>
</td>
<td class="cellrowborder" valign="top" width="35.980000000000004%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p66849440155725">String</p>
</td>
<td class="cellrowborder" valign="top" width="38%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p46095573155725">Error code when the API call fails.</p>
<p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0160620263_p42753918155725">This parameter is not included when the API call succeeds.</p>
</td>
</tr>
<tr id="modelarts_04_0166__en-us_topic_0180094058_row169814265230"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0170904393_p165091347181414">is_success</p>
</td>
<td class="cellrowborder" valign="top" width="35.980000000000004%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0170904393_p132973125542">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="38%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0166__en-us_topic_0180094058_en-us_topic_0170904393_p14433359122514">Whether the API call succeeds</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="modelarts_04_0158.html">Training Jobs</a></div>
</div>
</div>