Tags:
create new tag
view all tags

APPX Background Processing

This document discusses APPX background processing.

Overview

Background processes refers to the ability of APPX to spawn another session to run a report or finish other processing. This will free the foreground session immediately and allow the user to do something else. If you run something in background that requires any user interaction, APPX wil behave as if the user pressed the END key. This is true on all Linux/Unix platforms, but in some versions of APPX on Windows the background process will hang waiting for user input, therefore on Windows platforms you should ensure your backgound job does not require any user input.

Before a job or process can be run in background the designer must check the 'Separate Task' flag on the job step. Without this setting the job will always run in foreground, regardless of anything else. NOTE: A side effect of checking this flag is that you cannot get any values back from the job or process, even if it is run in foreground.

Next, either the user has to request background processing on the Disposition screen by clicking the 'Submit to BG' button or the Designer can set --- SUBMIT PROCESS to Y in the Pre-Invocation Event Point. There are other --- SUBMIT fields available, but those are intended for use with any 3rd party job queue managers, APPX does not use them.

On Linux/Unix platforms, APPX runs the appx_submit script to invoke a background job. This script in in the $APPXPATH folder. On Windows platforms, the engine invokes the background session directly without using a script or batch file. If you want APPX to use a script on Windows so that you can customize the behaviour, set the APPX_BG_SCRIPT environment variable (see below).

On all platforms the engine will spawn another APPX session, passing the -session flag. This flag points to a temporary file that contains the context, i.e., any open files, any work fields and anything the background session needs to continue processing.

APPX Designer

For example, we can modify the SALESREP LISTING job in DMO by checking the 'Sep. Task' option:

JOB-OUTPUT-001.gif

If the user clicks the 'Submit to BG' button on the Disposition screen, the report will run in background. Alternatively, the Designer could set --- SUBMIT PROCESS to Y in the Pre-invocation step of the Output, and the report would always run in background regardless of the user's selection.

Setting APPX_BG_SCRIPT

You can customize the processing by setting APPX_BG_SCRIPT to your own script. On Linux/Unix platforms, we recommend copying the existing appx_submit script and changing your copy. If you customize appx_submit directly it will get replaced when you upgrade APPX and you customizations will be lost. On Windows, there is no existing script or batch file, so you will have to create your own. Either way, you must set APPX_BG_SCRIPT to point to your script file. See Setting Environment Variables for more information on settting environment variables. The script is assumed to be in the $APPXPATH folder,

The script will receive 8 arguements: -image, -session, -mode, -notify, -date, -priority, -queue, and -user. In Release 5.4.4 & higher, the script will also receive -options which will contain whatever data is in the --- SUBMIT OPTIONS PDF and -appxuser which contains the 3 character APPX user id. This might have been entered by the user on the Submit to Background screen in the 'Submit Options' field, or set by the Designer directly.

Example appx_submit.cmd Windows batch file

The following is an example of a Windows script that will invoke the background job. We are using a .cmd script, but it could a .bat file as well.

::APPX_SUBMIT.CMD

:: A Typical Argument list will be 8 Arguments passed from APPX
:: -image, -session, -mode, -notify, -date, -priority, -queue, and -user
:: Windows will break on the equals sign giving us 16 arguments in total
:: We will ignore all but the -image and -session pairs to submit
:: an APPX session with syntax that will be similar to
:: c:\APPX\Appx.exe -session=BY2Z7JDC

:: If you were to view each argument passed to APPX_SUBMIT.CMD with the
:: following loop:

:: FOR %%A IN (%*) DO (
:: echo %%A >> c:\Appx\arglist.txt
:: )

:: You would likely see something like this in arglist.txt
:: -image 
:: C:\Appx\Appx.exe 
:: -session 
:: BY2Z7JDC 
:: -mode 
:: SPOOL 
:: -notify 
:: Yes 
:: -date 
:: 2009031201020202 
:: -priority 
:: 1 
:: -queue 
:: A 
:: -user 
:: Administrator

:: The following command should execute APPX with the session data as
:: an argument
::

%2 %3=%4

Comments:

Read what other users have said about this page or add your own comments.



-- JoeOrtagus - 10 Mar 2009
Topic attachments
I Attachment History Action Size Date Who Comment
GIFgif JOB-OUTPUT-001.gif r2 r1 manage 38.9 K 2009-03-10 - 20:13 JoeOrtagus JOB OUTPUT - Notice the Sep. Task value is checked.
GIFgif JOB-OUTPUT-002.gif r1 manage 24.3 K 2009-03-10 - 20:13 JoeOrtagus JOB OUTPUT - Notice Submit to BG button
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2016-02-19 - JeanNeron
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback