<?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>topic Re: Extracting job state in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/704924#M1047</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28909"&gt;@AllanBowe&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your reasoning is correct. The stateDetails ONLY returns a value when the job /state is "completed". If you then run a GET&amp;nbsp;&lt;SPAN data-offset-key="2r38k-1-0"&gt;/jobExecution/jobs/&lt;/SPAN&gt;&lt;SPAN class="resolvedVariable"&gt;&lt;SPAN data-offset-key="2r38k-2-0"&gt;{{jobID}} and more info is available you'll see the state details. For example, I submitted a job (with SAS code that I know would produce a warning message. Then I sent the call referenced above and I see the following in the response:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="resolvedVariable"&gt;&lt;SPAN data-offset-key="2r38k-2-0"&gt; "state": "completed",&lt;BR /&gt;"stateDetails": "warning",&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="resolvedVariable"&gt;&lt;SPAN data-offset-key="2r38k-2-0"&gt;I hope this clears things up.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2020 04:17:40 GMT</pubDate>
    <dc:creator>joeFurbee</dc:creator>
    <dc:date>2020-12-10T04:17:40Z</dc:date>
    <item>
      <title>Extracting job state</title>
      <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/700923#M1032</link>
      <description>&lt;P&gt;The &lt;A href="https://developer.sas.com/apis/rest/v3.5/Compute/#job-39-s-statedetails-registry" target="_self"&gt;documentation&lt;/A&gt; refers to an additional property called `stateDetails` that can indicate the job state according to the log (warning, info, error etc)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However this never appears for us in the API response.&amp;nbsp; Is it set automatically?&amp;nbsp; Or is it just a placeholder that customers should populate themselves after performing log analysis?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 21:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/700923#M1032</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-11-23T21:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting job state</title>
      <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/701526#M1033</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28909"&gt;@AllanBowe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I got this back from a colleague:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;stateDetails&lt;/EM&gt; is a field the job execution provider (NOT the user) sets - in other words it would get set automatically and is only applicable to the "completed" state.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm working on getting some more info.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To investigate the "completed" state when the job fails, the first way to troubleshoot is to run a get on the job:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;GET: {{sasserver}}/reportImages/jobs/{{jobid}}&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should provide more info on what happened during the job execution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally, in the response from the call above, you can locate the log from this endpoint:&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;"logLocation":&amp;nbsp;"/files/files/49b70680-c318-471d-bac9-889bff80a8bc"&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Append this endpoint with &lt;EM&gt;/content&lt;/EM&gt; and you can see the contents of the Compute session:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;{{sasserver}}&lt;EM&gt;/files/files/49b70680-c318-471d-bac9-889bff80a8bc/content&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;yields&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"version":&amp;nbsp;2,&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"name":&amp;nbsp;"items",&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"accept":&amp;nbsp;"application/vnd.sas.compute.log.line",&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"start":&amp;nbsp;0,&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"items":&amp;nbsp;[&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"version":&amp;nbsp;1,&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"type":&amp;nbsp;"source",&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"line":&amp;nbsp;"1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proc&amp;nbsp;sql;"...........&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thanks,&lt;/DIV&gt;
&lt;DIV&gt;Joe&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Nov 2020 13:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/701526#M1033</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-11-25T13:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting job state</title>
      <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/702565#M1036</link>
      <description>&lt;P&gt;Thanks Joe!&lt;BR /&gt;&lt;BR /&gt;To give some context, we're using this to determine job status when interfacing with the Viya APIs as part of the &lt;A href="https://cli.sasjs.io/" target="_self"&gt;SASjs CLI,&lt;/A&gt; the command looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;sasjs job execute /path/to/my/job -l path/to/job.log --status status.txt&lt;/PRE&gt;
&lt;P&gt;My guess, based on responses, is that the `completed` status is _replaced_ with the `stateDetails` value when errors or warnings are found.&amp;nbsp; Be good to confirm this though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 16:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/702565#M1036</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-11-30T16:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting job state</title>
      <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/704924#M1047</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28909"&gt;@AllanBowe&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your reasoning is correct. The stateDetails ONLY returns a value when the job /state is "completed". If you then run a GET&amp;nbsp;&lt;SPAN data-offset-key="2r38k-1-0"&gt;/jobExecution/jobs/&lt;/SPAN&gt;&lt;SPAN class="resolvedVariable"&gt;&lt;SPAN data-offset-key="2r38k-2-0"&gt;{{jobID}} and more info is available you'll see the state details. For example, I submitted a job (with SAS code that I know would produce a warning message. Then I sent the call referenced above and I see the following in the response:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="resolvedVariable"&gt;&lt;SPAN data-offset-key="2r38k-2-0"&gt; "state": "completed",&lt;BR /&gt;"stateDetails": "warning",&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="resolvedVariable"&gt;&lt;SPAN data-offset-key="2r38k-2-0"&gt;I hope this clears things up.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 04:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/704924#M1047</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-12-10T04:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting job state</title>
      <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/705006#M1048</link>
      <description>would it be possible to get a complete list of values for the /state endpoint?</description>
      <pubDate>Thu, 10 Dec 2020 09:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/705006#M1048</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-12-10T09:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting job state</title>
      <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/705071#M1049</link>
      <description>&lt;P&gt;Here is a complete list of /state values:&lt;/P&gt;
&lt;P&gt;&lt;A name="op:getJobState" target="_blank"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;TABLE class="operation GET"&gt;
&lt;TBODY&gt;
&lt;TR class="synopsis"&gt;
&lt;TH&gt;Path:&lt;/TH&gt;
&lt;TD&gt;&lt;SPAN class="path"&gt;/jobs/{jobId}/state&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR class="definition"&gt;
&lt;TD colspan="2" class="definition"&gt;
&lt;DIV class="op-description"&gt;Returns the following states: pending, running, canceled, completed, or failed.&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;A name="op:getJobState" target="_blank"&gt;&lt;/A&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I meant to mention (you may have seen it already) when "stateDetails" returns in the response, the "error" object should return in the response as well with the message. Something like:&lt;/P&gt;
&lt;LI-CODE lang="json"&gt;    },
    "state": "completed",
    "stateDetails": "warning",
    "endTimeStamp": "2020-12-10T14:12:39.506Z",
    "heartbeatTimeStamp": "2020-12-10T14:12:34.094Z",
    "submittedByApplication": "jobExecution",
    "heartbeatInterval": 600,
    "elapsedTime": 6114,
    "results": {
        "COMPUTE_CONTEXT": "SAS Job Execution compute context",
        "COMPUTE_JOB": "EA965EB3-DF9D-EB41-A990-6FF54791EE06",
        "EA965EB3-DF9D-EB41-A990-6FF54791EE06.log.txt": "/files/files/f650a15e-97ab-4aab-bb77-f0f88eda0e06",
        "COMPUTE_SESSION": "8566c785-a142-47f9-b941-f65e256dbd09-ses0000 Ended."
    },
    "logLocation": "/files/files/ad14e8d0-5e88-45e4-9af5-2564fa052d48",
    "error": {
        "errorCode": 5710,
        "message": "Apparent symbolic reference Y not resolved.",
        "links": [],
        "version": 2,
        "httpStatusCode": 0
    },&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IOW, the "warning" generated when my code ran in SAS is returned in the "error" "message" object.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 14:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/705071#M1049</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-12-10T14:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting job state</title>
      <link>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/705626#M1051</link>
      <description>nice!&lt;BR /&gt;&lt;BR /&gt;fyi, we also see "idle" being returned from this endpoint.</description>
      <pubDate>Mon, 14 Dec 2020 10:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Extracting-job-state/m-p/705626#M1051</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-12-14T10:36:49Z</dc:date>
    </item>
  </channel>
</rss>

