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

120 lines
14 KiB
HTML

<a name="modelarts_04_0163"></a><a name="modelarts_04_0163"></a>
<h1 class="topictitle1">Obtaining the Name of a Training Job Log File</h1>
<div id="body8662426"><div class="section" id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_section35881040102516"><h4 class="sectiontitle">Sample Code</h4><p id="modelarts_04_0163__en-us_topic_0180094056_p928204112425">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_0163__en-us_topic_0180094056_ul8839341211"><li id="modelarts_04_0163__en-us_topic_0180094056_li118303414215">Method 1: Obtain the file based on the specified <strong id="modelarts_04_0163__en-us_topic_0180094056_b0261115616434">job_id</strong> and <strong id="modelarts_04_0163__en-us_topic_0180094056_b6262956164315">version_id</strong>.<div class="codecoloring" codetype="Python" id="modelarts_04_0163__en-us_topic_0180094056_screen235234242111"><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">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;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">job_log_list</span> <span class="o">=</span> <span class="n">estimator</span><span class="o">.</span><span class="n">get_job_log_file_list</span><span class="p">()</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
<ul id="modelarts_04_0163__en-us_topic_0180094056_ul12658113613219"><li id="modelarts_04_0163__en-us_topic_0180094056_li19658173672118">Method 2: Obtain the file based on the training job created in <a href="modelarts_04_0131.html">Creating a Training Job</a>.<div class="codecoloring" codetype="Python" id="modelarts_04_0163__en-us_topic_0180094056_screen1517494516212"><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">job_log_list</span> <span class="o">=</span> <span class="n">job_instance</span><span class="o">.</span><span class="n">get_job_log_file_list</span><span class="p">()</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
<ul id="modelarts_04_0163__en-us_topic_0180094056_ul1229583914214"><li id="modelarts_04_0163__en-us_topic_0180094056_li22951397214">Method 3: Obtain the file based on 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_0163__en-us_topic_0180094056_screen17445144718219"><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">job_log_list</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">get_job_log_file_list</span><span class="p">()</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_section85751315416"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_table155461191218" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Estimator request parameters</caption><thead align="left"><tr id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_row254817912212"><th align="left" class="cellrowborder" valign="top" width="18.81188118811881%" id="mcps1.3.2.2.2.5.1.1"><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p12549899214">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.861386138613863%" id="mcps1.3.2.2.2.5.1.2"><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p3552101193813">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.871287128712872%" id="mcps1.3.2.2.2.5.1.3"><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p1755169172118">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54.45544554455446%" id="mcps1.3.2.2.2.5.1.4"><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p55521998211">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_row8893215413"><td class="cellrowborder" valign="top" width="18.81188118811881%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p6891421842">modelarts_session</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p68972047">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.871287128712872%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p158912219419">Object</p>
</td>
<td class="cellrowborder" valign="top" width="54.45544554455446%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_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_0163__en-us_topic_0180094056_en-us_topic_0170904393_row197933582219"><td class="cellrowborder" valign="top" width="18.81188118811881%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p10361105925611">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p196751771039">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.871287128712872%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p8675972311">String</p>
</td>
<td class="cellrowborder" valign="top" width="54.45544554455446%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p354118145165">ID of a training job. Obtain <strong id="modelarts_04_0163__b56995147416">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_0163__en-us_topic_0180094056_filepath1790145761716"><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_0163__en-us_topic_0180094056_en-us_topic_0170904393_row105532902114"><td class="cellrowborder" valign="top" width="18.81188118811881%" headers="mcps1.3.2.2.2.5.1.1 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p212669145714">version_id</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.2.2.2.5.1.2 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p955361173817">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.871287128712872%" headers="mcps1.3.2.2.2.5.1.3 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p327982618582">String</p>
</td>
<td class="cellrowborder" valign="top" width="54.45544554455446%" headers="mcps1.3.2.2.2.5.1.4 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p388712374570">Version ID of a training job. Obtain <strong id="modelarts_04_0163__b116276311642">version_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_0163__filepath1162817317412"><b>job_instance.version_id</b></span>, or from the response 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_0163__en-us_topic_0180094056_en-us_topic_0170904393_table3969737616316" frame="border" border="1" rules="all"><caption><b>Table 2 </b><strong id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_b5195552123119">get_job_log_file_list</strong> response parameters</caption><thead align="left"><tr id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_row4420603516316"><th align="left" class="cellrowborder" valign="top" width="19%" id="mcps1.3.2.3.2.4.1.1"><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p201671416332">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.2.3.2.4.1.2"><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p1121753616332">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_0163__en-us_topic_0180094056_en-us_topic_0170904393_p3620524816332">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_row13693818959"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p36949182517">error_msg</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p4694111814518">String</p>
</td>
<td class="cellrowborder" valign="top" width="67%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p3759625025">Error message when the API call fails.</p>
<p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p1883217281754">This parameter is not included when the API call succeeds.</p>
</td>
</tr>
<tr id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_row1122668316316"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p2549041516332">error_code</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p732886516332">String</p>
</td>
<td class="cellrowborder" valign="top" width="67%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p16694551165">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_0163__i94381344742">ModelArts API Reference</em>.</p>
<p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p5676720116332">This parameter is not included when the API call succeeds.</p>
</td>
</tr>
<tr id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_row977626816316"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p306381116332">log_file_list</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p3611764516332">List</p>
</td>
<td class="cellrowborder" valign="top" width="67%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p3984816716332">Log file name of a training job. A single-node job has only one log file, and a distributed job has multiple log files.</p>
</td>
</tr>
<tr id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_row162969122544"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.2.3.2.4.1.1 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p165091347181414">is_success</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.2.4.1.2 "><p id="modelarts_04_0163__en-us_topic_0180094056_en-us_topic_0170904393_p132973125542">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="67%" headers="mcps1.3.2.3.2.4.1.3 "><p id="modelarts_04_0163__en-us_topic_0180094056_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>