【问题标题】:How to use rsubmit in SAS for running a process in background without waiting it to be finished如何在 SAS 中使用 rsubmit 在后台运行进程而不等待它完成
【发布时间】:2020-08-07 21:33:27
【问题描述】:

我确实有以下设置:

流程引擎通过 rest 调用 SAS 中的存储过程 (STP)。 这个存储的过程然后调用另一个宏,这将需要大约。一小时完成。 该宏应该是在后台运行的,因此 STP 可以只是流回宏已成功启动。 长宏完成后,它使用 proc http 告诉流程引擎它已经完成。

我的问题是,当我尝试使用 rsubmit 运行宏时,STP 会在完成自身运行之前等待宏完成。

我正在使用以下简化代码来解决我的问题: 标准普尔:

%macro my_stp;
    
  %let rhost=&syshostname. 7551;  
  signon rhost user='***' password='***';
     rsubmit remote=rhost connectwait=no;
       %include "<path to mymacro>"; 
       %mymacro;
     endrsubmit;
  signoff rhost;  
 
%mend;

%my_stp;

宏代码:

%macro mymacro;
  %put Hello World;
  data _null_;
    call sleep(10,1);
  run;
%mend;

如何确保 STP 不等待宏完成? 感谢您的帮助!

【问题讨论】:

    标签: rest sas sas-macro


    【解决方案1】:

    _action=background 参数添加到您的 STP。例如,如果您通过 URL 提交:

    https://mysashost.com/SASStoredProcess/do?_program=/MySTPDir/MySTP&amp;_action=background

    如果您不希望整个 STP 在后台运行,则需要为 rsubmit 块创建单独的 STP,通过 proc http 调用它,并向其添加 action=_background 参数。

    %macro my_stp;
        
      proc http url='https://mysashost.com/SASStoredProcess/do_program=/MySTPDir/MyRsubmitProgram&_action=background';
      run;
    
      <other code>;
    
    %mend;
    

    【讨论】:

    • 感谢您的帮助!我已经尝试过这个选项,理论上它应该可以工作。但是当我尝试使用后台 proc http 时,无论我使用的是 username/pw 还是 http_tokenauth,我总是会被定向到登录页面。当我将 URL 粘贴到浏览器中时,后台调用确实有效。我将为此另开一篇文章,因为它是另一个主题。
    • 这是我后续问题的链接:stackoverflow.com/questions/63336796/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-25
    • 2019-10-20
    • 1970-01-01
    相关资源
    最近更新 更多