Expression functions
Basic functions
All expressions (${{ <expression }}
) support a set of pre-built functions:
Return the length of the argument.
Return the keys of the dictionary.
Convert a string to lowercase.
Convert a string to uppercase.
Perform string formatting.
Convert an object to a JSON string.
Convert a JSON string to an object.
Upload a volume to the Apolo storage.
Parse a volume reference string to an object.
Calculate a SHA256 hash of given files.
Get values from a dictionary.
Convert any object to a string.
Replace all occurrences of a symbol sequence in a string with a new one.
Concatenate an array of strings by inserting a separator between them
len(s)
len(s)
Return the length of an object (the number of items it contains). The argument may be a string, a list, or a dictionary.
Example:
keys(dictionary)
keys(dictionary)
Get the list of keys in a dictionary.
Example:
lower(string)
lower(string)
Convert a string to lowercase.
Example:
upper(string)
upper(string)
Convert a string to uppercase.
Example:
fmt(format_string, arg1, ...)
fmt(format_string, arg1, ...)
Perform a string formatting operation. The format_string
can contain text or replacement fields delimited by curly braces {}
. The replacement field will be replaced with other arguments' string values in order they appear in the format_string
.
Example:
to_json(data)
to_json(data)
Example:
from_json(json_string)
from_json(json_string)
Parse a JSON string to an object.
Example:
upload(volume_ctx)
upload(volume_ctx)
This function allows to automatically upload a volume before a job runs.
Example:
parse_volume(string)
parse_volume(string)
Example:
hash_files(pattern, ...)
hash_files(pattern, ...)
File names are relative to the flow's root (${{ flow.workspace }}
).
Glob patterns are supported:
*
matches everything
?
matches any single character
[seq]
matches any character in seq
[!seq]
matches any character not in seq
**
recursively matches this directory and all subdirectories
The calculated hash contains hashed filenames to generate different results when the files are renamed.
Example:
inspect_job(job_name, [suffix])
inspect_job(job_name, [suffix])
Example:
values(dict_instance)
values(dict_instance)
Get values from a dictionary. This is similar to Python's dict_instance.values()
.
Example:
str(any)
str(any)
Convert any object to a string.
Example:
replace(string, old, new)
replace(string, old, new)
Replace all occurrences of old
in string
with new
.
Example:
join(separator, array)
join(separator, array)
Concatenate an array of strings by inserting a separator between them.
Example:
Task status check functions
True
if given dependencies succeeded.
True
if some of the given dependencies failed.
Mark a task to be always executed.
success([task_id, ...])
success([task_id, ...])
Example:
Example with arguments:
failure([task_id, ...])
failure([task_id, ...])
Example:
Example with arguments:
always()
always()
Example:
Last updated
Was this helpful?