Files
doc-exports/docs/modelarts/api-ref/ShowTrainingJobLogsPreview.html
2025-05-09 10:22:58 +00:00

149 lines
13 KiB
HTML

<a name="EN-US_TOPIC_0000002233886850"></a><a name="EN-US_TOPIC_0000002233886850"></a>
<h1 class="topictitle1">Querying the Logs of a Specified Task in a Given Training Job (Preview)</h1>
<div id="body32001227"><div class="section" id="EN-US_TOPIC_0000002233886850__section17291155322618"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000002233886850__p132929537261">This API is used to query the logs of a specified task in a given training job (preview).</p>
</div>
<div class="section" id="EN-US_TOPIC_0000002233886850__section1729215534267"><h4 class="sectiontitle">URI</h4><p id="EN-US_TOPIC_0000002233886850__p729295382610">GET /v2/{project_id}/training-jobs/{training_job_id}/tasks/{task_id}/logs/preview</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002233886850__table1293185320269" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Path Parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002233886850__row13293653122617"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.1"><p id="EN-US_TOPIC_0000002233886850__p13294185342617">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.2"><p id="EN-US_TOPIC_0000002233886850__p1729405312265">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.3"><p id="EN-US_TOPIC_0000002233886850__p8294105322620">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.2.3.2.5.1.4"><p id="EN-US_TOPIC_0000002233886850__p52941853182611">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000002233886850__row4293145362616"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000002233886850__p0294195313264">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000002233886850__p82942053172620">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000002233886850__p729425316262">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000002233886850__p13294253162610">Project ID. For details, see <a href="modelarts_03_0147.html">Obtaining a Project ID and Name</a>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002233886850__row82931553172620"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000002233886850__p8295135352618">training_job_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000002233886850__p929513536268">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000002233886850__p16295453112620">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000002233886850__p229585372617">Training job ID For details about how to obtain the value, see <a href="ListTrainingJobs.html">Querying the Training Job List</a>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002233886850__row829315318269"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000002233886850__p32951533267">task_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000002233886850__p42951053182614">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000002233886850__p1429585312268">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000002233886850__p18295553192618">Name of a training job. You can obtain the value from the <strong id="EN-US_TOPIC_0000002233886850__b629513534264">status.tasks</strong> field in the training job details.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002233886850__row1329365316260"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000002233886850__p0296165320269">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000002233886850__p20296145319263">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000002233886850__p1229695311261">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000002233886850__p1229645322616">Project ID. For details, see <a href="modelarts_03_0147.html">Obtaining a Project ID and Name</a>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002233886850__row329355316263"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000002233886850__p429612532268">training_job_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000002233886850__p829675362617">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000002233886850__p2296205314264">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000002233886850__p122961853182611">Training job ID For details about how to obtain the value, see <a href="ListTrainingJobs.html">Querying the Training Job List</a>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002233886850__row1029355320260"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000002233886850__p1629685310264">task_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000002233886850__p122978534265">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000002233886850__p16297153122612">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000002233886850__p1529775322620">Name of a training job. You can obtain the value from the <strong id="EN-US_TOPIC_0000002233886850__b82971553102616">status.tasks</strong> field in the training job details.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000002233886850__section162971553172616"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0000002233886850__p4297175316267">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0000002233886850__section11297115342611"><h4 class="sectiontitle">Response Parameters</h4><p id="EN-US_TOPIC_0000002233886850__p4297145322612"><strong id="EN-US_TOPIC_0000002233886850__b1829735382615">Status code: 200</strong></p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002233886850__en-us_topic_0000002091282813_response_TrainLog" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Response body parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002233886850__row1829785311268"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.2.4.1.1"><p id="EN-US_TOPIC_0000002233886850__p1229855320268">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.3.2.4.1.2"><p id="EN-US_TOPIC_0000002233886850__p1129819537264">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.2.4.1.3"><p id="EN-US_TOPIC_0000002233886850__p229835382616">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000002233886850__row20298853202619"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002233886850__p1298125332613">content</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002233886850__p1029845315264">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002233886850__p9299195332612">Log content. If the size of a log file does not exceed the upper limit (n MB), all the log files are returned. Otherwise, the latest log file (n MB) is returned. After 2022/03/01 00:00:00 (GMT+08:00), the parameter name is changed from context to content.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002233886850__row19298753152610"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002233886850__p1229905317261">current_size</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002233886850__p15299105318262">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002233886850__p8299253152617">Size of the returned log content, in bytes. The maximum size is 5 MB.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000002233886850__row1529835311264"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002233886850__p172991053162613">full_size</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002233886850__p1299155302611">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002233886850__p12299125315263">Size of complete log content, in bytes</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000002233886850__section129917539261"><h4 class="sectiontitle">Example Requests</h4><p id="EN-US_TOPIC_0000002233886850__p430017532264">The following shows how to obtain the worker-0 logs of the training job whose UUID is <strong id="EN-US_TOPIC_0000002233886850__b1930011535264">2cd88daa-31a4-40a8-a58f-d186b0e93e4f</strong>.</p>
<pre class="screen" id="EN-US_TOPIC_0000002233886850__screen1530065312263">GET https://endpoint/v2/{project_id}/training-jobs/2cd88daa-31a4-40a8-a58f-d186b0e93e4f/tasks/worker-0/logs/preview</pre>
</div>
<div class="section" id="EN-US_TOPIC_0000002233886850__section1630019532263"><h4 class="sectiontitle">Example Responses</h4><p id="EN-US_TOPIC_0000002233886850__p1430013535268"><strong id="EN-US_TOPIC_0000002233886850__b0300195332614">Status code: 200</strong></p>
<p id="EN-US_TOPIC_0000002233886850__p1630017539268">ok</p>
<pre class="screen" id="EN-US_TOPIC_0000002233886850__screen930025317263">{
"content" : "[Modelarts Service Log]collect and upload logs end at 2021-05-18-14:28:13\n[Modelarts Service Log]exiting..:\n [Modelarts Service Log]exiting...\n[Modelarts Service Log]exiting..:\n [Modelarts Service Log]exiting...\n[Modelarts Service Log]exit with :\n [Modelarts Service Log]exit with 0\n[Modelarts Service Log]exit with :\n [Modelarts Service Log]exit with 0\n[ModelArts Service Log][INFO][2021/05/18 14:28:14,207]:\n output-handler finalizing due to: [training finished]\n[ModelArts Service Log][INFO][2021/05/18 14:28:14,207]:\n output-handler finalized\n[Modelarts Service Log][sidecar] exiting at 2021-05-18-14:28:14\n[Modelarts Service Log][sidecar] wait python processes exit..:\n [Modelarts Service Log][sidecar] wait python processes exit...\n[Modelarts Service Log][sidecar] exit with :\n [Modelarts Service Log][sidecar] exit with 0",
"current_size" : 126548,
"full_size" : 5242880
}</pre>
</div>
<div class="section" id="EN-US_TOPIC_0000002233886850__section18300175310267"><h4 class="sectiontitle">Status Codes</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002233886850__en-us_topic_0000002091282813_status_code" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000002233886850__row10301553152610"><th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.7.2.1.3.1.1"><p id="EN-US_TOPIC_0000002233886850__p13301165342610">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="85%" id="mcps1.3.7.2.1.3.1.2"><p id="EN-US_TOPIC_0000002233886850__p183015533266">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000002233886850__row11301195319264"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000002233886850__p330114531263">200</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="EN-US_TOPIC_0000002233886850__p9301165372617">ok</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000002233886850__section1630111534269"><h4 class="sectiontitle">Error Codes</h4><p id="EN-US_TOPIC_0000002233886850__p6301953122619">See <a href="modelarts_03_0095.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="algorithms.html">Training Management</a></div>
</div>
</div>