<?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: Running StoredProcess from a C# wrapper using API never getting response that it finished in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678172#M899</link>
    <description>API. Should be a method there. Sorry, trying to help but in the dark a bit.</description>
    <pubDate>Thu, 20 Aug 2020 16:41:38 GMT</pubDate>
    <dc:creator>AlanC</dc:creator>
    <dc:date>2020-08-20T16:41:38Z</dc:date>
    <item>
      <title>Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678148#M896</link>
      <description>&lt;P&gt;We crated a C# wrapper that calls a SAS stored process that takes more than an hour.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The stored process finished, and I can see that on the sas side, but it never returns a message back to the wrapper that it finishes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone have something working that you can share?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What the wrapper is doing is:&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;UserContext userContext = CreateUserContext(metadataServer, port);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;StoredProcess storedProcess = new StoredProcess(userContext, storedProcLocation);&lt;/P&gt;&lt;P&gt;storedProcess.SetPromptValue("thread_id", thread_id);&lt;BR /&gt;storedProcess.SetPromptValue("connect_source", sourceDsn);&lt;BR /&gt;storedProcess.SetPromptValue("connect_destination", destDsn);&lt;BR /&gt;storedProcess.SetPromptValue("HIST_DATE", HistoryDate.ToString("MM/dd/yyyy"));&lt;BR /&gt;storedProcess.SetPromptValue("POS_DATE", PositionDate.ToString("MM/dd/yyyy"));&lt;BR /&gt;storedProcess.SetPromptValue("pRunType", pRunType);&lt;BR /&gt;storedProcess.SetPromptValue("p_model_type", modelType);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Execution execute = storedProcess.Execute();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return LogStoredProcessResult(execute, storedProcLocation);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When it runs Execute() it never returns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 15:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678148#M896</guid>
      <dc:creator>rhains</dc:creator>
      <dc:date>2020-08-20T15:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678154#M897</link>
      <description>Quick reply since I don't have code in front of me but make sure you close any open processes. I think there is a Close method.</description>
      <pubDate>Thu, 20 Aug 2020 15:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678154#M897</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2020-08-20T15:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678161#M898</link>
      <description>&lt;P&gt;Hi Alan, thanks for your answer.&lt;/P&gt;&lt;P&gt;When you say Close any Open process, do you mean in the SAS side? or in the API ?&lt;/P&gt;&lt;P&gt;Richard&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, 20 Aug 2020 16:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678161#M898</guid>
      <dc:creator>rhains</dc:creator>
      <dc:date>2020-08-20T16:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678172#M899</link>
      <description>API. Should be a method there. Sorry, trying to help but in the dark a bit.</description>
      <pubDate>Thu, 20 Aug 2020 16:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678172#M899</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2020-08-20T16:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678200#M901</link>
      <description>&lt;P&gt;Thanks Alan. Here is the Method I am invoking.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS process is working fine, is this Method that Execute the SAS process, that does not pass to the next line&lt;/P&gt;&lt;P&gt;after&lt;/P&gt;&lt;P&gt;Execution execute = storedProcess.Execute();&amp;nbsp;&lt;/P&gt;&lt;P&gt;when the STored Process takes long time to execute.&lt;/P&gt;&lt;P&gt;If I change the value on parmeter modelType to for example Factor, that makes the SAS stored process to compute less rows, and in that case the EXECUTE() method returns fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my problem is when the stored process takes more than an hour. It process on the SAS side but looks like the Execute method is timing out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code on my Method in the wrapper.&lt;/P&gt;&lt;P&gt;using System;&lt;BR /&gt;using System.Web.Services;&lt;BR /&gt;using SAS.BI.AuthenticationService.ClientUserContext;&lt;BR /&gt;using SAS.BI.StoredProcessService;&lt;BR /&gt;using SAS.BI.StoredProcessService.Exec;&lt;BR /&gt;using SAS.BI.StoredProcessService.IO;&lt;BR /&gt;using System.Configuration;&lt;BR /&gt;using System.Collections.Generic;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[WebMethod]&lt;/P&gt;&lt;P&gt;public bool RunStressGenDataModel(int HistoryOffsetDays, int PositionOffsetDays)&lt;BR /&gt;{&lt;BR /&gt;log.LogDebug("--------------------------------------------------------");&lt;BR /&gt;log.LogDebug("Starting RunGenModelStress");&lt;BR /&gt;string metadataServer="cpwnpsas01.corp.capitalpower.com";&lt;BR /&gt;string thread_id = DateTime.Now.ToString("yyyyMMddhhmmss");&lt;BR /&gt;string pRunType = "Daily";&lt;BR /&gt;string sourceDsn = "dsn=Allegro_Stress_Auth;Trusted_Connection=yes;database=allegro_stress";&lt;BR /&gt;string destDsn = "dsn=Allegro_Stress_Auth;Trusted_Connection=yes;database=allegro_stress";&lt;BR /&gt;DateTime HistoryDate = DateTime.Today.AddDays(HistoryOffsetDays);&lt;BR /&gt;DateTime PositionDate = DateTime.Today.AddDays(PositionOffsetDays);&lt;BR /&gt;string modelType = "_ALL_VALUES_";&lt;BR /&gt;int port = 8561;&lt;/P&gt;&lt;P&gt;UserContext userContext = CreateUserContext(metadataServer, port);&lt;/P&gt;&lt;P&gt;try&lt;BR /&gt;{&lt;BR /&gt;string storedProcLocation = ConfigurationManager.AppSettings["GenDataModelStress"].ToString();&lt;BR /&gt;StoredProcess storedProcess = new StoredProcess(userContext, storedProcLocation);&lt;BR /&gt;log.LogDebug(String.Format("RunGenModelStress using location of {0}", storedProcLocation));&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;* If the parameter names in the Stored Proc ever change, you have to change them here as well&lt;BR /&gt;*/&lt;BR /&gt;storedProcess.SetPromptValue("thread_id", thread_id);&lt;BR /&gt;storedProcess.SetPromptValue("connect_source", sourceDsn);&lt;BR /&gt;storedProcess.SetPromptValue("connect_destination", destDsn);&lt;BR /&gt;storedProcess.SetPromptValue("HIST_DATE", HistoryDate.ToString("MM/dd/yyyy"));&lt;BR /&gt;storedProcess.SetPromptValue("POS_DATE", PositionDate.ToString("MM/dd/yyyy"));&lt;BR /&gt;storedProcess.SetPromptValue("pRunType", pRunType);&lt;BR /&gt;storedProcess.SetPromptValue("p_model_type", modelType);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Execution execute = storedProcess.Execute();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return LogStoredProcessResult(execute, storedProcLocation);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;throw new Exception(ex.Message);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 18:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678200#M901</guid>
      <dc:creator>rhains</dc:creator>
      <dc:date>2020-08-20T18:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678213#M902</link>
      <description>&lt;P&gt;Man, I double-posted something and it messed up a few posts so hopefully works right this time (and I am not a DA).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Isolate the issue. Pull that code out to a Console app and try it there to make sure the timeout is not occurring on the web side. Start with that.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 18:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678213#M902</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2020-08-20T18:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678238#M903</link>
      <description>&lt;P&gt;Thanks Alan.&amp;nbsp;&lt;/P&gt;&lt;P&gt;One last question. How do you know, looking in some logs in the SAS server, that a stored procedure finish processing. Do you know if SAS log something?&lt;/P&gt;&lt;P&gt;And it which log file.&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 19:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678238#M903</guid>
      <dc:creator>rhains</dc:creator>
      <dc:date>2020-08-20T19:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678247#M904</link>
      <description>No, sorry. I rarely use stored procedures in SAS. I submit code directly and keep pgms locally or net accessible. I did find a few examples I have of StoredProcess submission. Here is one (old and using Framework, not Core):&lt;BR /&gt;&lt;BR /&gt;                StoredProcessService sp = SasCore.SasLanguageService.StoredProcessService;&lt;BR /&gt;                sp.Repository = storedProcLibrary;&lt;BR /&gt;                sp.Execute(storedProcedureName, newParms);&lt;BR /&gt;                var sro = new SasRunObject();&lt;BR /&gt;&lt;BR /&gt;                SasCore.SasLanguageService.LineSeparator = "\r\n";&lt;BR /&gt;                sro.SasList = SasCore.SasLanguageService.FlushList(SasCore.ListCharactersToReturn).Replace("\f", "");&lt;BR /&gt;                sro.SasLog = SasCore.SasLanguageService.FlushLog(SasCore.LogCharactersToReturn).Replace("\f", "");&lt;BR /&gt;&lt;BR /&gt;Again, make sure you clear things out t (null/Close/etc.) when done with them. Also, you may glean some info from my SGF paper on Lightweight SAS Web Services.</description>
      <pubDate>Thu, 20 Aug 2020 19:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678247#M904</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2020-08-20T19:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Running StoredProcess from a C# wrapper using API never getting response that it finished</title>
      <link>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678256#M905</link>
      <description>Try using ALTLOG system option if you can or proc printto for log redirection. If the concern is with the storedproc. If you just want to submit SAS code on the server, consider just using the SASLanguageService vs the StoredProcess service.</description>
      <pubDate>Thu, 20 Aug 2020 20:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Running-StoredProcess-from-a-C-wrapper-using-API-never-getting/m-p/678256#M905</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2020-08-20T20:08:10Z</dc:date>
    </item>
  </channel>
</rss>

