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
shell
job steps within your workflow. - Temporary outputs from
shell
jobs that are not intended to be permanent project files or uploaded to z/OS. - Staging data downloaded by a
shell
job from an external source (e.g., a web API) before further processing by anothershell
job.
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.yml
outputs to avoid ambiguity or collisions. -
Actual local file path generation:
- When a job declares an
output
with alocal-temp://
path, or aninput
that 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.dat
might 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.ResolvedPaths
maps 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
shell
jobs:- As an
input
to ashell
job: The environment variable (e.g.,$GRACE_INPUT_MYTEMPFILE
) will contain the absolute local path to this temporary file (within the.local-staging
directory). - As an
output
from ashell
job: The environment variable (e.g.,$GRACE_OUTPUT_MYTEMPFILE
) will contain the absolute local path within the.local-staging
directory 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 subsequentshell
job 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 -v
orgrace submit
'sworkflow.log
):- Verbose logs will show the
GRACE_INPUT_...
andGRACE_OUTPUT_...
environment variables being set forshell
jobs, which contain these resolved paths. - Look for messages from the
ShellHandler
or path resolution steps. - Example log line from
ShellHandler
preparing 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-staging
Directory:- After a workflow run (especially if paused or if
keep: true
is 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
shell
job 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: true
is 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
shell
jobs. - 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 ashell
job 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.