Skip to main content

ExtractFunctionName

Extracts the function name from a task name. If an environment is set, it strips the "environment." prefix from the task name; otherwise, it falls back to taking the last segment after splitting on ".."

def ExtractFunctionName(
ctx: context.Context,
taskName: string,
environment: string
) - > string

Extracts the function name from a task name. If an environment is provided, it attempts to strip the "environment." prefix; otherwise, it falls back to taking the last segment after splitting on ".".

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for logging.
taskNamestringThe full task name from which to extract the function name.
environmentstringThe environment name. If not empty, the function will attempt to remove this prefix from the task name.

Returns

TypeDescription
stringThe extracted function name.