PSEC - Powershell Enhanced Capability
Version 1.2.1

Task Structure


A Workflow is a set of steps. Each step involves a running or performing a task. In these documents the notion of Step and Task are used interchangeably.

The internal structures described here are built by function populateFlowTaskList.


The Workflow configuration file, described at NAME-cfg.json Format, is used to define the task:

  • sequence within Workflow (by virtue of the sequence in the configuration file)
  • lib or name parameter
  • title
  • type
  • dependencies.

Folder Structure

Within the tasks folder described at Directory Structure, the specific task files are defined or created during the run. Assume TASK-NAME is the task name, these files are expected or will be created by the execution of the task. The will exist in a sub-folder of tasks called TASK-NAME and also referred to as the Task Folder in this documentation. They are:

  • TASK-NAME-def.psm1 - This file is used to provide the execution parameters. Its format is dependent on the task type. It is described at Execution below.

  • - Used to provide specific task help. While not mandatory, its existence makes the Workflow more usable, especially if the Workflow is used infrequently. It is dynamically converted to an .rtf format so it can be dynamically be loaded into a WPF rich text box. Consequently, specific @@ shortcuts should not be used. The format details can be found at PSEC - Markdown Usage.

[comment]: # (this produces the RTF for the help file)

### Purpose ####

This step is used demonstrate the dependency feature of the PSEC workflow system.

### Operation ####

The previous step this is dependent on must have been run sucessfully for this step to be allowed to run.
  • brief.json.txt - The summary file that is expected to be produced by the Task. It is a single level JSON format file that summarizes the execution of the Task. The sCondCode value is used to determine the status and should contain GOOD or FAIL. The other values are loaded alphabetically into the status window.
  "zMsgs": [
    "getTS=2022-11-17 04:19:18",
    "ukn=13 cmds=22 funcs=18 classes=33 methods=0 vbls=0 other=109",
    "=== Overall elapsed 4.50 secs"
  "sStr1": "20220914",
  "sGen": "1",
  "bBool1": false,
  "bTrap": false,
  "sCondCode": "GOOD"
  • runlog.txt - This is the system output generated by the task. It can be viewed by View Log link on the  2  Status Panel. It can also be viewed with an editor if searching is required. An editor that automatically refreshes itself if the task is rerun is recommended.

  • option.json.txt - a file used to persist the option values last used in the Task execution. Refer to Task Options.


The TASK-NAME-def.psm1 file is used to provide specific parameters to the underlying Task execution facilities of PSEC. What these are depends somewhat on the Task type.

Below is a sample .psm1 file that executes a Java Task type. The actual structure and function are described in Task Execution Script.

# demo-options

set-strictmode -version 2.0

function defineFlowTask([Flow]$flow,[Task]$task) {
#--- define
  $def = new-module -asCustomObject -scriptBlock {
    # shows how to present contextual variables
    function getTaskDesc([Task]$task) {
      $tfs = $task.tfs;
      [string]$desc        = @"
This illustrates options capability of the PSEC workflow subsystem.`r`n
Current Values: cycleNo=$($tfs.globMap.demoGlobs.cycleNo) month=$($tfs.globMap.demoGlobs.month)`r`n
      return $desc;

    function fetchJavaMain([Object]$task,[hashtable]$parms) {
      return 'org.srp.psec.TestArgsPsec'

    function fetchJavaClassStr([Object]$task,[hashtable]$parms) {
      return '$env:PSEC_V4_UTILS/srp-util/lib;$env:PSEC_V4_UTILS/srp-util/java-gen-prod/production/srp-util;$env:PSEC_V4_UTILS/gael-core/lib;$env:PSEC_V4_UTILS/gael-core/libaux;'

    # ---------- define task parameters
    The $htOpts parms has the processed options.  It can be modified or used to do
    other changes to the setup.
      function params([Object]$task,[hashtable]$htOpts) {
        #$tfs = $task.tfs;
        $date = Get-Date
        [string]$dateStr = $date.ToString("yyyyMMdd")

        $htOpts.datestr = $dateStr;
        $htOpts.brief   = "$($task.statlocn)"
        return  $htOpts

      # ---------- define task options
      function options([Task]$task) {
        $opts = @();

        #$tfs = $task.tfs;
        $opts += @{type='input';  parm='gen';     label='Gen';     place='number of lines to generate'; regex='^[0-9]+$'}
        $opts += @{type='input';  parm='genstr';  label='GenStr';  place='string to generate'}
        $opts += @{type='check';  parm='bool1';   label='bool1';   place='turns on bool1 option when checked'}
        $opts += @{type='radio';  parm='trap';    label='trap';    valset='*/*no trap,fail/gen FAIL,trap/gen TRAP'}
        $opts += @{type='combo';  parm='combo';   label='combo';   valset='*/*--none--,green,red/show red,blue/set blue'}
        return  ,$opts

      Export-ModuleMember -Variable * -Function *

  return $def;
PSEC - Powershell Enhanced Capability

Copyright © 2018-2021, 2022, Rexcel System Inc.