<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>It seems that there are some details that would need addressed.</p>
    <p>A suspend signal is nothing more than sending a SIGSTP (like
      hitting ctrl-s), so the application is still in memory awaiting
      SIGCONT</p>
    <p>So what should happen when it continues and there are no more
      licenses? So the proper place for what you are looking for is in
      the application itself. If it is given a SIGSTP, it could release
      the licenses and then check them out again when SIGCONT is
      received.</p>
    <p>If you are able to tell your app to release/request a license
      externally, you may want to have a wrapper to do the signal
      handling until they have it as part of their app.</p>
    <p>Brian Andrus</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 10/14/2019 4:40 AM, Oytun Peksel
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:ed565d93a87e43d5bd8b1eba8e8457e5@semcon.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1368288141;
        mso-list-type:hybrid;
        mso-list-template-ids:-1029154388 69009409 69009411 69009413 69009409 69009411 69009413 69009409 69009411 69009413;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">It
            is quite weird if slurm has no mechanism as described. I
            have been digging more into it and someone suggested a
            workaround using mail notifications. You use a script
            instead of the mail application and catch the event then use
            use sacct to see what is happening.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Two
            problems with this:
            <o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
            style="font-family:Symbol;color:#1F497D" lang="EN-US"><span
              style="mso-list:Ignore">·<span style="font:7.0pt
                "Times New Roman"">       
              </span></span></span><!--[endif]--><span
            style="color:#1F497D" lang="EN-US">There is no mail sent
            with suspended preemption<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
            style="font-family:Symbol;color:#1F497D" lang="EN-US"><span
              style="mso-list:Ignore">·<span style="font:7.0pt
                "Times New Roman"">       
              </span></span></span><!--[endif]--><span
            style="color:#1F497D" lang="EN-US">If you use requeue
            instead there will be a mail event and you can catch it.
            Sacct will flag it as “preempted” so you know it is
            requeued. But then it would change it pending. So you really
            need to be quick to catch it. Also there is no distinctive
            flag for resuming.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Anyone
            has any other method to execute scripts during preemption?<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <p class="MsoNormal"
            style="margin-bottom:12.0pt;line-height:11.0pt"><span
              style="color:#1F497D;mso-fareast-language:SV" lang="EN-US"><br>
              <br>
              <o:p></o:p></span></p>
          <table class="MsoNormalTable" style="width:375.0pt" width="0"
            cellspacing="0" cellpadding="0" border="0">
            <tbody>
              <tr>
                <td colspan="3" style="padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal" style="line-height:10.0pt"><b><span
style="font-size:10.0pt;color:black;mso-fareast-language:SV">Oytun Peksel</span></b><span
style="font-size:10.0pt;color:black;mso-fareast-language:SV"><o:p></o:p></span></p>
                </td>
              </tr>
              <tr>
                <td style="padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal" style="line-height:10.0pt"><span
style="font-size:10.0pt;color:black;mso-fareast-language:SV"><a
                        href="mailto:oytun.peksel@semcon.com"
                        moz-do-not-send="true"><span style="color:black">oytun.peksel@semcon.com
                        </span></a><o:p></o:p></span></p>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm"><br>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm"><br>
                </td>
              </tr>
              <tr>
                <td style="width:345.0pt;padding:0cm 0cm 0cm 0cm"
                  width="460">
                  <p class="MsoNormal" style="line-height:10.0pt"><span
style="font-size:10.0pt;color:black;mso-fareast-language:SV">+46739205917<o:p></o:p></span></p>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm"><br>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm"><br>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
                  style="mso-fareast-language:SV" lang="EN-US">From:</span></b><span
                style="mso-fareast-language:SV" lang="EN-US">
                slurm-users
                <a class="moz-txt-link-rfc2396E" href="mailto:slurm-users-bounces@lists.schedmd.com"><slurm-users-bounces@lists.schedmd.com></a>
                <b>On Behalf Of </b>Oytun Peksel<br>
                <b>Sent:</b> den 11 oktober 2019 09:10<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:slurm-users@lists.schedmd.com">slurm-users@lists.schedmd.com</a><br>
                <b>Subject:</b> [slurm-users] Execute scripts on suspend
                and cancel<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Hi,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I was wondering is there an option in Slurm
          to execute custom scripts before Suspend signal.  What I need
          to do is to tell an application to release it’s licenses
          before sending the suspend signal during preemption. I think
          went through all the documentation but could not find a
          mechanism like this.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">BR<o:p></o:p></p>
        <p class="MsoNormal">/Oytun<o:p></o:p></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;font-family:"Times New
            Roman",serif;mso-fareast-language:SV"><br>
          </span><span
            style="font-size:7.5pt;color:gray;mso-fareast-language:SV"><br>
            <i>When you communicate with us or otherwise interact with
              Semcon, we will process personal data that you provide to
              us or we collect about you, please read more in our
              <a href="https://semcon.com/data-privacy-policy/"
                moz-do-not-send="true">Privacy Policy</a>.</i></span><span
            style="font-size:12.0pt;font-family:"Times New
            Roman",serif;mso-fareast-language:SV"><o:p></o:p></span></p>
      </div>
    </blockquote>
  </body>
</html>