Stop AcuSolve job in Altair Access web

Sebastian Yang
Sebastian Yang Altair Community Member
edited August 8 in Community Q&A

Hi,

I have access to Altair Access Web version where I can submit jobs and download the result files once completed.

My question is that when I submit an Acusolve job, I run it and  I want to send it a signal to stop it but I don´t know how can I do it.

Is it possible to even do it?

Thank you.

 

 

Answers

  • Bill Calver_22424
    Bill Calver_22424 New Altair Community Member
    edited December 2022

    Hi Sebastian,

    In the Access interface, on the Jobs tab there will be two buttons active in the upper right of the window when a job is running.  These are Terminate and Custom Actions.

    image

    Terminate:

    • Stops a job immediately (similar to a qdel command)
    • Only output that has already been written will be available after the job ends.

    Custom Actions/acuSigStop:

    • Signals AcuSolve to stop cleanly meaning that it will write out data at the end of the current step and then end the job.
    • The Log file will contain messages similar to what is shown below indicating what is being written out prior to stopping:

    image

  • Sebastian Yang
    Sebastian Yang Altair Community Member
    edited December 2022

    Hi Sebastian,

    In the Access interface, on the Jobs tab there will be two buttons active in the upper right of the window when a job is running.  These are Terminate and Custom Actions.

    image

    Terminate:

    • Stops a job immediately (similar to a qdel command)
    • Only output that has already been written will be available after the job ends.

    Custom Actions/acuSigStop:

    • Signals AcuSolve to stop cleanly meaning that it will write out data at the end of the current step and then end the job.
    • The Log file will contain messages similar to what is shown below indicating what is being written out prior to stopping:

    image

    Hi Bill,

    I actually tried clicking on that bottom, but the options in the dropdown menu are quite different than yours...

    These are the options

    image

    As you can see, there is no stop option.

    Shoud I contact my administrator?

  • Bill Calver_22424
    Bill Calver_22424 New Altair Community Member
    edited December 2022

    Hi Bill,

    I actually tried clicking on that bottom, but the options in the dropdown menu are quite different than yours...

    These are the options

    image

    As you can see, there is no stop option.

    Shoud I contact my administrator?

    Hi Sebastian,

    Yes, that would be the best next step as those custom actions were most likely created by your local systems team.

     

  • Adarsh_20887
    Adarsh_20887
    Altair Employee
    edited August 8

    Implementation details for reference:

    Please refer this guide:
    https://2023.help.altair.com/2023.2.0/accessweb/pdfs/DivingIntoApplicationDefinitions2023.2.0.pdf
    - Check Application Actions

    Two files responsible for Application actions:
    - Actions xml (app-actions-AcuSolve.xml)
    - action script acuSigStop.py ( this should be placed in runtime folder of AcuSolve)

    AcuSolve (app-def structure)

        app-inp-AcuSolve.xml

        app-conv-AcuSolve.xml

        app-actions-AcuSolve.xml

        runtime/start.py  acuSigStop.py

        submittime/presubmit.py

     

    Sample actions xml and script

     

    app-actions-AcuSolve.xml
    #############################################################################

    <?xml version="1.0" encoding="UTF-8"?>
    <ApplicationActions xmlns="http://schemas.altair.com/pbs/2009/01/app-actions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="http://schemas.altair.com/pbs/2009/01/app-actions ../../app-actions.xsd">
    <ApplicationId>AcuSolve</ApplicationId>
    <CustomAction>

    <JobStates>
    <JobState>RUNNING</JobState>
    </JobStates>

    <Name>acuSigStop</Name>
    <DisplayName>acuSigStop</DisplayName>
    <Description>Stop AcuSolveJob with AcuSig command</Description>

    <Executable>
    <Language>PYTHON</Language>
    <Name>acuSigStop.py</Name>
    </Executable>

    </CustomAction>

    </ApplicationActions>


    acuSigStop.py
    #########################################################


    import sys,os,subprocess

    if os.environ['PAS_HST_RUN'] == "true" or os.environ['PAS_HST_RUN'] == "true;false" or (        os.environ['PAS_INPUTFILE'] == os.environ['PAS_JOBFILES'] ):
       dir=os.path.dirname(str(os.environ['PAS_INPUTFILE']).replace('pbscp://admin',''))
    else:
        dir=str(os.environ['PBS_JOBDIR'])

    print 'Directory to execute acuSig is: ' + dir
    cmd='cd ' + dir + '&&' + '/altair/hw/' + str(os.environ['PAS_VERSION']) + '/altair/acusolve/linux64/script/.acusim-sh&&/altair/hw/' + str(os.environ['PAS_VERSION']) + '/altair/acusolve/linux64/bin/acuSig -out -res -rst -stop'
    print 'cmd to execute is: ' + cmd
    res = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    #rc = res.returncode
    #print 'cmd invocation Exit Status: ' + str(rc)
    out = res.stdout.readlines()
    print 'stdout = ' + str(out)
    err = res.stderr.readlines()
    print 'stderr = ' + str(err)
    res.communicate()
    sys.stdout.flush()
    sys.stderr.flush()
    rc = res.returncode
    #print rc
    print 'cmd invocation Exit Status: ' + str(rc)