local-temp://
The local-temp:// prefix is used to declare temporary local files that are created, managed, and cleaned up by Grace. These are useful for:
- Storing intermediate data passed between different
shelljob steps within your workflow. - Temporary outputs from
shelljobs that are not intended to be permanent project files or uploaded to z/OS. - Staging data downloaded by a
shelljob from an external source (e.g., a web API) before further processing by anothershelljob.
Grace handles the actual local file path generation within a run-specific staging area.
Resolution
-
Logical Identifier: The string following
local-temp://(e.g.,scratch_data.json,processed_chunk_1.txt) acts as a logical identifier for this temporary local file within the scope of your Grace workflow. This identifier must be unique among allzos-temp://andlocal-temp://paths defined in yourgrace.ymloutputs to avoid ambiguity or collisions. -
Actual local file path generation:
- When a job declares an
outputwith alocal-temp://path, or aninputthat consumes such an output, Grace resolves this virtual path to a concrete local file path. - This path is typically located within a run-specific local staging directory, usually:
your_workflow_directory/.grace/logs/<run_specific_directory>/.local-staging/<logical_identifier_for_temp_file>- e.g.
local-temp://intermediate.datmight resolve to something likemyproject/.grace/logs/20231028T120000_run_xxxx/.local-staging/intermediate.dat.
- e.g.
- This resolved physical path is stored internally by Grace (
ctx.ResolvedPathsmaps the virtual path to just the<logical_identifier_for_temp_file>, and the full path is constructed usingctx.LocalStageDir).
- When a job declares an
-
Interaction with
shelljobs:- As an
inputto ashelljob: The environment variable (e.g.,$GRACE_INPUT_MYTEMPFILE) will contain the absolute local path to this temporary file (within the.local-stagingdirectory). - As an
outputfrom ashelljob: The environment variable (e.g.,$GRACE_OUTPUT_MYTEMPFILE) will contain the absolute local path within the.local-stagingdirectory where the script must write its output.
- As an
-
Interaction with z/OS jobs:
local-temp://paths are not directly usable by z/OS job types (compile,linkedit,execute) as they refer to files on the local Grace execution machine.- If data from a
local-temp://file needs to go to the mainframe, a subsequentshelljob would need to read it (via itsGRACE_INPUT_...variable) and then output it using azos://orzos-temp://path to trigger an upload.
Finding the generated local file path
If you need to know the exact physical local path Grace generated for a local-temp:// resource (e.g., for debugging a shell job, or if you used keep: true):
-
Grace logs (
grace run -vorgrace submit'sworkflow.log):- Verbose logs will show the
GRACE_INPUT_...andGRACE_OUTPUT_...environment variables being set forshelljobs, which contain these resolved paths. - Look for messages from the
ShellHandleror path resolution steps. - Example log line from
ShellHandlerpreparing environment variables (conceptual): text DEBUG Setting shell env var GRACE_OUTPUT_SCRATCHDATA=/path/to/workflow/.grace/logs/YYYYMMDDTHHMMSS_run_xxxx/.local-staging/scratch_data.json
- Verbose logs will show the
-
Inspect the
.local-stagingDirectory:- After a workflow run (especially if paused or if
keep: trueis used), you can navigate to the run-specific log directory:.grace/logs/<run_specific_directory>/.local-staging/to see the files created there.
- After a workflow run (especially if paused or if
Typical usage examples
Intermediate file between two shell jobs:
Temporary output from a shell job:
Key considerations
- Lifecycle management:
local-temp://files are managed by Grace.- Creation: The
shelljob script writing to the$GRACE_OUTPUT_...path is responsible for creating the file content. Grace provides the designated path. - Location: Files are stored in a run-specific subdirectory within
.grace/logs/(typically.grace/logs/<run_id>/.local-staging/). - Cleanup: After the workflow completes, these temporary local files are automatically deleted based on the rules in
config.cleanup(defaults to deletion on success) unlesskeep: trueis specified in the output definition.
- Creation: The
- Local scope: These files exist only on the machine where Grace is running and are primarily intended for use by
shelljobs. - No automatic mainframe interaction: Unlike
zos-temp://, Grace does not automatically uploadlocal-temp://files to z/OS or download from z/OS to alocal-temp://path (unless ashelljob script explicitly performs such an action using Zowe CLI commands, for example). keep: true: If an output usinglocal-temp://haskeep: true, Grace will not delete the local temporary file during its cleanup phase.