<?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 SAS Viya Job Execution API call ending before the true ending in Developers</title>
    <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/819924#M6091</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to execute SAS code through the SAS Job Execution server (Version 2.2) on Viya&amp;nbsp; platform (&lt;SPAN&gt;V.03.05)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I call the API through shell script and curl command as follow:&lt;/P&gt;&lt;PRE&gt;#--- Execute SAS job
rc_curl=$(curl -k -X POST "https://${tenant}.${BASEAPIURL}/SASJobExecution/" \
   --connect-timeout 14400 \
   -H "Authorization: Bearer $ACCESS_TOKEN" \
   -H 'Content-Type: application/x-www-form-urlencoded' \
   -H 'Accept: *' \
   -d "_program=/Projects/my_program/&amp;amp;_log=${log}&amp;amp;_param=${param}&amp;amp;_timeout=14400&amp;amp;CSRF=\$CSRF\$" 
   )&lt;/PRE&gt;&lt;P&gt;I redirect the log in my SAS program in another location in order to parse it with my shell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works well when the program ran fast, but sometime the program can take a very long time (more than 1 hour).&lt;/P&gt;&lt;P&gt;The issue is that in this case,&amp;nbsp; the curl command exit, as if the Job is finished. But when I check in the Job Execution Interface, it is still running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I though that it was my access_token but the time validity is set to 14400 (approx 4h).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try the timeout option of curl with same value but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what is the issue. Does someone have an idea ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2022 09:18:14 GMT</pubDate>
    <dc:creator>willi_m</dc:creator>
    <dc:date>2022-06-23T09:18:14Z</dc:date>
    <item>
      <title>SAS Viya Job Execution API call ending before the true ending</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/819924#M6091</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to execute SAS code through the SAS Job Execution server (Version 2.2) on Viya&amp;nbsp; platform (&lt;SPAN&gt;V.03.05)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I call the API through shell script and curl command as follow:&lt;/P&gt;&lt;PRE&gt;#--- Execute SAS job
rc_curl=$(curl -k -X POST "https://${tenant}.${BASEAPIURL}/SASJobExecution/" \
   --connect-timeout 14400 \
   -H "Authorization: Bearer $ACCESS_TOKEN" \
   -H 'Content-Type: application/x-www-form-urlencoded' \
   -H 'Accept: *' \
   -d "_program=/Projects/my_program/&amp;amp;_log=${log}&amp;amp;_param=${param}&amp;amp;_timeout=14400&amp;amp;CSRF=\$CSRF\$" 
   )&lt;/PRE&gt;&lt;P&gt;I redirect the log in my SAS program in another location in order to parse it with my shell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works well when the program ran fast, but sometime the program can take a very long time (more than 1 hour).&lt;/P&gt;&lt;P&gt;The issue is that in this case,&amp;nbsp; the curl command exit, as if the Job is finished. But when I check in the Job Execution Interface, it is still running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I though that it was my access_token but the time validity is set to 14400 (approx 4h).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try the timeout option of curl with same value but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what is the issue. Does someone have an idea ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 09:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/819924#M6091</guid>
      <dc:creator>willi_m</dc:creator>
      <dc:date>2022-06-23T09:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Viya Job Execution API call ending before the true ending</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/819930#M6092</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/180783"&gt;@willi_m&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We also observed shaky behaviour in long-running jobs in Viya 3.5 - and so we implemented a 'retries' feature in the SASjs CLI, which ultimately fixed the issue (the customer was running many long-running jobs, so was tested quite heavily)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find the docs here:&amp;nbsp;&amp;nbsp;&lt;A href="https://cli.sasjs.io/job/" target="_blank"&gt;https://cli.sasjs.io/job/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Allan&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 09:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/819930#M6092</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2022-06-23T09:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Viya Job Execution API call ending before the true ending</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/819947#M6093</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;thanks for your answer, i will see if it is possible to install and use this package on my company (as there is some restrictions for the installation of external tool).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Things that i noticed and forget in my issue description, is that the curl (rc_curl variable) return me that thing:.&lt;/P&gt;&lt;PRE&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&amp;gt;
&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;
&amp;lt;title&amp;gt;502 Proxy Error&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Proxy Error&amp;lt;/h1&amp;gt;
&amp;lt;p&amp;gt;The proxy server received an invalid
response from an upstream server.&amp;lt;br /&amp;gt;
The proxy server could not handle the request &amp;lt;em&amp;gt;&amp;lt;a href="/SASJobExecution/"&amp;gt;POST&amp;amp;nbsp;/SASJobExecution/&amp;lt;/a        &amp;gt;&amp;lt;/em&amp;gt;.&amp;lt;p&amp;gt;
Reason: &amp;lt;strong&amp;gt;Error reading from remote server&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;P&gt;any idea ?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 11:24:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/819947#M6093</guid>
      <dc:creator>willi_m</dc:creator>
      <dc:date>2022-06-23T11:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Viya Job Execution API call ending before the true ending</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/820380#M6094</link>
      <description>&lt;P&gt;It happens sometimes.&amp;nbsp; Actually, quite frequently.&amp;nbsp; It's not necessarily a Viya issue, could be networking / system related.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SASjs is MIT open source, there are no usage restrictions.&amp;nbsp; You can compile it directly from github:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/sasjs/cli" target="_blank"&gt;https://github.com/sasjs/cli&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you can build your own tool to poll the status and perform X number of retries for a non-200 response.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 13:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/820380#M6094</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2022-06-25T13:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Viya Job Execution API call ending before the true ending</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/828945#M6139</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;You might be experiencing what's described here:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Job Execution Time-out&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/jobexecug/p1ct9uzl5c7omun1t2zy0gxhlqlc.htm#n1l1c94xox7r2vn1bzyp8on38so1" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/jobexecug/p1ct9uzl5c7omun1t2zy0gxhlqlc.htm#n1l1c94xox7r2vn1bzyp8on38so1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, then using &lt;FONT face="courier new,courier"&gt;_action=wait&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;_action=background&lt;/FONT&gt; might help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;&lt;EM&gt;Formerly&lt;/EM&gt; SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 23:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/828945#M6139</guid>
      <dc:creator>Vince_DelGobbo</dc:creator>
      <dc:date>2022-08-16T23:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Viya Job Execution API call ending before the true ending</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/890789#M6413</link>
      <description>&lt;P&gt;After some search we found a solution, that i will explain here for other people in the same case.&lt;/P&gt;&lt;P&gt;We change the endpoint to trigger to not launch job directly but creating a JobRequest.&lt;/P&gt;&lt;P&gt;Then the JobRequest is launch and we parse the response to take the JobExecutionId.&lt;/P&gt;&lt;P&gt;Then in a loop we check the status of the job every 15-20sec until the Status is "COMPLETED".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all for you help.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 14:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/890789#M6413</guid>
      <dc:creator>willi_m</dc:creator>
      <dc:date>2023-08-24T14:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Viya Job Execution API call ending before the true ending</title>
      <link>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/890794#M6414</link>
      <description>&lt;P&gt;That's pretty much what the SASjs CLI does (although it starts by polling fast, then polls more slowly).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for sharing your solution!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 14:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-Viya-Job-Execution-API-call-ending-before-the-true-ending/m-p/890794#M6414</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2023-08-24T14:55:21Z</dc:date>
    </item>
  </channel>
</rss>

