leadtime99_cond_cleanup.py

Abstract:
Conversion from CA-7 creates output conditions based on the successor jobs in LJOB report in
ALL folders that execute the successor. 
However, when a successor has a leadtime=99 requirement towards its predecessor, 
the conditions should apply only to successors that are executed in the same flow (folder, in CTM) 
as the predecessor

What this script is for:
Analyze the jobs that contain a SETVAR for Lead-Time = 99 
Search for the conditions for predecessor/successor connected with leadtime=99
Delete OUT conditions for jobs that are not present in the folder where the successor resides

Prerequisites:
Some Python libraries necessary for execution may not be present on your machine.
Therefore, before executing the script for the first time you should run the following commands
from the system prompt/shell 
cd \folder_where_you_unpacked_the_script
pip install -r requirements.txt
or, alternatively, 
pip install -r c:\folder_where_you_unpacked_the_script\requirements.txt

where c: is the drive letter where the script resides
and folder_where_you_unpacked_the_script is the folder where you unpacked the zip file containing
the script and this readme

In doubt whether this command has already been executed, do run it again - if it has already been
executed, it will do no harm.

Invoke the script by: 
    PY leadtime99_cond_cleanup.py -i <inputfile> -o <outputdir> -l <logfile> -d <y/N> -x <Excelfile> -s <suffix>
Where:
    -i <inputfile> - the xml of the MF jobs, as created by the conversion or exported from EM. 
                  please note --infile is equivalent to -i

    -o <outputdir> - specify the path (absolute or relative) where the output file will be created 
                  default: out (a folder named out will be created in the current folder)
                  the name of the output file will be the same as the one in inputfile
                  please note: --odir is equivalent to -o

    -l <logfile>   - name of the log file. default leadtime99_cond_cleanup.log in current folder

    -d <y/n>       - delete conditions? default n (NO) 
                     when N, the xml output file will NOT be written
                     when Y, the xml output will be written without the unnecessary OUT conditions

    -x <Excelfile> - create an Excel sheet with all the conditions that should be deleted (or will
                     be deleted if -d is YES), plus the folder and job where they are located.
                     If <Excelfile> does not contain any folder reference, the file will be created
                     in <outputdir> - default = EMPTY (file will not be created)
    
    -s <suffix>    - suffix used in conversion for CONTROL-M condition names (SFXCND in ICE)
                     default: _OK 


