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 of the task name after splitting by ".".

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for logging.
taskNamestringThe full name of the task from which to extract the function name.
environmentstringThe environment name. If not empty, it is used to strip a prefix from the task name.

Returns

TypeDescription
stringThe extracted function name.