Tasks
A Task is the basic building block for a program execution on Firestarter. It contains the URL or CID of the program image, the command to execute in VM and the program arguments. It also has fields for defining the input and output files for the program.
Task specific input files are specified as inputContexts where the source
field contains either a URL or a Firestarter private IPFS network CID.
Input context target
specifies the file path in the program VM. Its prefix must always be /mnt/gevulot/input
Task specific output files are specified as outputContexts where the source
specifies the file path in the program VM. Its prefix must always be /mnt/gevulot/output
. retentionPeriod
value species how long the file is kept live in the Gevulot network. Unit of retentionPeriod
is seconds. In general 900
(15 minutes) is a good default.
Example
Here is a Hello World example task that reads a text input file from an HTTP URL, prints it and writes the system's CPU & RAM information into the output file.
The task can be submitted using gvltctl.
Install the latest gvltctl
tool from releases.
gvltctl task create -e "$GEVULOT_ENDPOINT" -n "$GEVULOT_MNEMONIC" -f task.yaml
The gvltctl
will then submit a transaction that allocates a dedicated worker for the task on-chain. The output looks roughly as follows:
You can use gvltctl task get
to fetch the latest version of a task (with the status field):
In the example above, the task was already executed.
Task outputs
Taske always have stdout
and stderr
output stored in the Firestarter private IPFS network, if the respective storeStdout
and storeStderr
are set to true
. If the task has outputContexts
specified, the corresponding CIDs can be found from the status
part as well. The resulting CIDs in status.outputContexts
are in the same order as specified in the spec.outputContexts
.
In the above example, the output file produced by the program can be accessed through a read-only IPFS gateway at https://data.firestarter.gevulot.com/ipfs
For example above output file can be fetched with:
curl https://data.firestarter.gevulot.com/ipfs/QmfF7B77SF1ehLrohzphWj8YtpXLJ4biGFqJjW6sjPTUNe
Similarly the stdout and stderr can be fetched with:
curl https://data.firestarter.gevulot.com/ipfs/QmReATRWt5Cya4sCVUXGr9xiuta3StEg5R8WA14ojKNCpm
and
curl https://data.firestarter.gevulot.com/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH
Last updated