stdout.md

For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs; this page is available as Markdown.

Context: StdOut

The last thing written to the stdout file descriptor during a run is passed to the next run. Typically, this is used to pass state between runs using a JSON encoded string of an object that includes, for example, a list of IDs of resources that have already been processed or a timestamp of the most recently processed resource. The string passed to stdout is also used to power the data behind a dynamic config.

Below is an example of how to retrieve the contents of a context variable from the environment:

{% tabs %} {% tab title="Python" %}

import os
os.environ['PAN_CTX_LAST_SUCCESSFUL_RUN_STD_OUT']

{% endtab %}

{% tab title="JavaScript (Node)" %}

process.env.PAN_CTX_LAST_SUCCESSFUL_RUN_STD_OUT

{% endtab %}

{% tab title="Ruby" %}

ENV["PAN_CTX_LAST_SUCCESSFUL_RUN_STD_OUT"]

{% endtab %} {% endtabs %}

Context Variables

Below is a list of variables that are injected into the run environment with the PAN_CTX prefix.

name description notes
PAN_CTX_INTEGRATION_ID The Pandium ID of the Integration that is running currently. an integer unique to your account
PAN_CTX_INTEGRATION_NAME The name of the Integration that is running currently
PAN_CTX_TENANT_ID The Pandium ID of the Tenant that is running currently. An integer unique to your account
PAN_CTX_TENANT_NAME The name of the Tenant that is running currently.
PAN_CTX_RUN_MODE An enum of one of the following values: init, normal, webhook
PAN_CTX_RUN_TRIGGERS List of objects that contain the payload data for run triggers Can view the mode, source, and payload data as well as headers it was sent with
PAN_CTX_ENV The environment the sync is running in, i.e. dev/staging/prod
PAN_CTX_LAST_RUN_START_TIME A datetime that represents the time the last run started. i.e. 2021-07-24 20:04:21 +0000 UTC Will appear in environment only after first run.
PAN_CTX_LAST_RUN_COMPLETION_TIME A datetime that represents the time the last run completed. i.e. 2021-07-24 20:07:21 +0000 UTC Will appear in environment only after first run.
PAN_CTX_LAST_RUN_PHASE An enum of one of the following values: Succeeded, Failed (Platform Issue), Failed (Integration Issue), Failed (Timeout) Will appear in environment only after first run.
PAN_CTX_LAST_RUN_STD_OUT The JSON encoded string that was optionally printed to stdout during last Run.
PAN_CTX_LAST_SUCCESSFUL_RUN_START_TIME A datetime that represents the time the last successful run. i.e. 2021-07-24 20:04:21 +0000 UTC Will appear in environment only after successful first run.
PAN_CTX_LAST_SUCCESSFUL_RUN_COMPLETION_TIME A datetime that represents the time the last successful run completed. i.e. 2021-07-24 20:07:21 +0000 UTC Will appear in environment only after successful first run.
PAN_CTX_LAST_SUCCESSFUL_RUN_PHASE An enum of one of the following values: Succeeded, Failed (Platform Issue), Failed (Integration Issue), Failed (Timeout) Will appear in environment only after successful first run.
PAN_CTX_LAST_SUCCESSFUL_RUN_STD_OUT The JSON encoded string that was optionally printed to stdout during last successful Run.

A good way to use the saved state between runs via stdout is to continue running large syncs sequentially in a 'dynamic sync' process.

Below are some examples of writing to stdout in various languages

{% tabs %} {% tab title="C#" %}

Console.WriteLine("Hello World")

{% endtab %}

{% tab title="Java" %}

System.out.println("Hello World!");

{% endtab %}

{% tab title="NodeJS" %}

console.log('Hello World')

{% endtab %}

{% tab title="PHP" %}

echo "Hello World" . "\n"

{% endtab %}

{% tab title="Python" %}

print("Hello World!")

{% endtab %}

{% tab title="Ruby" %}

puts "Hello Word!"

{% endtab %} {% endtabs %}

Please Note: When handling context/stdout, there is a 128kb limit that is supported within Pandium.


Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the ask query parameter, and the optional goal query parameter:

GET https://docs.pandium.com/getting-started/anatomy-of-an-integration/environment-variables/stdout.md?ask=<question>&goal=<endgoal>

ask is the immediate question: it should be specific, self-contained, and written in natural language. goal is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.