doc-exports/docs/modelarts/sdk-ref/modelarts_04_0172.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

113 lines
12 KiB
HTML

<a name="modelarts_04_0172"></a><a name="modelarts_04_0172"></a>
<h1 class="topictitle1">Deleting a Training Job Version</h1>
<div id="body8662426"><div class="section" id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_section35881040102516"><h4 class="sectiontitle">Sample Code</h4><p id="modelarts_04_0172__en-us_topic_0180094065_p7979141613446">In ModelArts notebook, 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>
<ul id="modelarts_04_0172__en-us_topic_0180094065_ul133974718534"><li id="modelarts_04_0172__en-us_topic_0180094065_li15391847165318">Method 1: Delete a training job version based on the specified <strong id="modelarts_04_0172__en-us_topic_0180094065_b1880833652715">job_id</strong> and <strong id="modelarts_04_0172__en-us_topic_0180094065_b1580993610278">version_id</strong>.<div class="codecoloring" codetype="Python" id="modelarts_04_0172__en-us_topic_0180094065_screen18260165515532"><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>
<span class="normal">5</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">Estimator</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">job_id</span><span class="o">=</span><span class="s2">&quot;182626&quot;</span><span class="p">,</span> <span class="n">version_id</span><span class="o">=</span><span class="s2">&quot;278813&quot;</span><span class="p">)</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">estimator</span><span class="o">.</span><span class="n">delete_job_version</span><span class="p">()</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
<ul id="modelarts_04_0172__en-us_topic_0180094065_ul1072844935318"><li id="modelarts_04_0172__en-us_topic_0180094065_li12728104913530">Method 2: Delete the training job version created in <a href="modelarts_04_0168.html">Creating a Training Job Version</a>.<div class="codecoloring" codetype="Python" id="modelarts_04_0172__en-us_topic_0180094065_screen1198916415544"><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_version_instance</span><span class="o">.</span><span class="n">delete_job_version</span><span class="p">()</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
<ul id="modelarts_04_0172__en-us_topic_0180094065_ul187152115316"><li id="modelarts_04_0172__en-us_topic_0180094065_li198765216530">Method 3: Delete the training job version object returned in <a href="modelarts_04_0169.html">Querying the List of Training Job Versions</a>.<div class="codecoloring" codetype="Python" id="modelarts_04_0172__en-us_topic_0180094065_screen1023671745416"><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_version_instance_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">delete_job_version</span><span class="p">()</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_section85751315416"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_table155461191218" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Estimator request parameters</caption><thead align="left"><tr id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_row254817912212"><th align="left" class="cellrowborder" valign="top" width="18%" id="mcps1.3.2.2.2.5.1.1"><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p12549899214">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.2.2.5.1.2"><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p3552101193813">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13%" id="mcps1.3.2.2.2.5.1.3"><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p1755169172118">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54%" id="mcps1.3.2.2.2.5.1.4"><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p55521998211">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_row8893215413"><td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p6891421842">modelarts_session</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p68972047">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p158912219419">Object</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_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_0172__en-us_topic_0180094065_en-us_topic_0170904399_row197933582219"><td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p10361105925611">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p196751771039">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p8675972311">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p212635661310">ID of a training job. Obtain <strong id="modelarts_04_0172__b1815616292012">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_0172__filepath61569215200"><b>job_instance.job_id</b></span>, or from the response in <a href="modelarts_04_0160.html">Obtaining Training Jobs</a>.</p>
</td>
</tr>
<tr id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_row105532902114"><td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p212669145714">version_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p955361173817">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p327982618582">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p388712374570">Version ID of a training job. Obtain <strong id="modelarts_04_0172__b2375114322117">version_id</strong> from the response in <a href="modelarts_04_0169.html">Querying the List of Training Job Versions</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_table2531047171617" frame="border" border="1" rules="all"><caption><b>Table 2 </b><strong id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_b1335451917599">delete_job_version</strong> response parameters</caption><thead align="left"><tr id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_row19100144791610"><th align="left" class="cellrowborder" valign="top" width="18%" id="mcps1.3.2.3.2.4.1.1"><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p310064711165">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.3.2.4.1.2"><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p14102147181615">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="67%" id="mcps1.3.2.3.2.4.1.3"><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p71021347111613">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_row5102124719169"><td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p6102547121610">error_msg</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p11021047111615">String</p>
</td>
<td class="cellrowborder" valign="top" width="67%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p31021647151617">Error message when the API call fails.</p>
<p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p111021347201613">This parameter is not included when the API call succeeds.</p>
</td>
</tr>
<tr id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_row2102147131614"><td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p16102104751616">error_code</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p18102164781611">String</p>
</td>
<td class="cellrowborder" valign="top" width="67%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p1130718611618">Error code when the API fails to be called. For details, see <a href="https://docs.otc.t-systems.com/modelarts/api-ref/common_parameters/error_codes.html" target="_blank" rel="noopener noreferrer">Error Codes</a> in <em id="modelarts_04_0172__i18976104914215">ModelArts API Reference</em>.</p>
<p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p61021147111611">This parameter is not included when the API call succeeds.</p>
</td>
</tr>
<tr id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_row120775510328"><td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p3208115516321">is_success</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_p1820817559324">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="67%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0172__en-us_topic_0180094065_en-us_topic_0170904399_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_0167.html">Training Job Versions</a></div>
</div>
</div>