khiops.core.internals.task
Submodule of khiops.core.internals
Core API functions abstractions
| CLASS | DESCRIPTION |
|---|---|
KhiopsTask |
Specification of a Khiops Task |
KhiopsTaskFamily |
Stores the versions of a task |
KhiopsTaskRegistry |
Registry of Khiops tasks |
| FUNCTION | DESCRIPTION |
|---|---|
encode_path_valued_arg |
Encodes an argument containing paths (str or dict) |
get_task_registry |
Direct access to the registry |
Classes
KhiopsTask(name, tool_name, intro_version, args_signature, kwargs_signature, path_valued_arg_names, scenario_template)
Specification of a Khiops Task
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Name of the task.
TYPE:
|
tool_name
|
Name of the tool to execute the task (ex. "khiops", "khiops_coclustering").
TYPE:
|
intro_version
|
Khiops version where this task object was introduced.
TYPE:
|
args_signature
|
A list of 2-tuples for each mandatory parameter of the task, containing: - its name (str) - its type (KhiopsTaskArgumentType)
TYPE:
|
kwargs_signature
|
A list of 3-tuples for each optional parameter of the task, containing: - its name (str) - its type (KhiopsTaskArgumentType) - its default value
TYPE:
|
path_valued_arg_names
|
A list of the parameters that contain paths. They must be contained either in args_signature or kwargs_signature. The only accepted types are StringLikeType or containers thereof.
TYPE:
|
scenario_template
|
A Khiops scenario template. The template mini-language is described above.
TYPE:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
scenario |
Scenario object built from |
| METHOD | DESCRIPTION |
|---|---|
write_execution_scenario |
Writes a task's execution scenario file contents for the specified arguments |
Methods:
write_execution_scenario(writer, args)
Writes a task's execution scenario file contents for the specified arguments
| PARAMETER | DESCRIPTION |
|---|---|
writer
|
Writer object for the scenario file.
TYPE:
|
args
|
Task arguments. Includes mandatory and optional arguments.
TYPE:
|
KhiopsTaskFamily(task_name, end_version=None)
Stores the versions of a task
| PARAMETER | DESCRIPTION |
|---|---|
task_name
|
The name of the task defining this family.
TYPE:
|
end_version
|
The Khiops version where the support for this task ended.
TYPE:
|
See class docstring
| METHOD | DESCRIPTION |
|---|---|
register_task |
Registers a task to this family |
unregister_task |
Unregister the task from the family with the specified introduction version |
get_task |
Returns latest task object compatible with the specified version |
| ATTRIBUTE | DESCRIPTION |
|---|---|
end_version |
KhiopsVersion : Khiops version where support for this task ended
|
start_version |
KhiopsVersion : Khiops version where the support for this task started
|
all_intro_versions |
list of KhiopsVersion : A sorted list of the task introduction
|
latest_intro_version |
KhiopsVersion : The latest introduction version of the task.
|
Attributes
end_version
property
writable
KhiopsVersion : Khiops version where support for this task ended
It is None if the task is still supported. May be set with either str or
KhiopsVersion or None.
start_version
property
KhiopsVersion : Khiops version where the support for this task started
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If there are no task registered in this family. |
all_intro_versions
property
list of KhiopsVersion : A sorted list of the task introduction versions.
The list is sorted in reverse order.
latest_intro_version
property
KhiopsVersion : The latest introduction version of the task.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If there are no task objects registered in this family. |
Methods:
register_task(task, overwrite=False)
Registers a task to this family
| PARAMETER | DESCRIPTION |
|---|---|
task
|
The task to be registered. Must have the same name of the family.
TYPE:
|
overwrite
|
If
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If:
|
unregister_task(intro_version)
Unregister the task from the family with the specified introduction version
| PARAMETER | DESCRIPTION |
|---|---|
intro_version
|
The introduction version of the task to be unregistered.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
KhiopsTask
|
The removed task object. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If there is no task with the specified introduction version. |
get_task(target_version)
Returns latest task object compatible with the specified version
| PARAMETER | DESCRIPTION |
|---|---|
target_version
|
The target Khiops version.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
KhiopsTask
|
The latest task object compatible with the |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If target_version is not str or KhiopsVersion. |
KhiopsTaskRegistry()
Registry of Khiops tasks
Tasks are indexed by name and version.
| METHOD | DESCRIPTION |
|---|---|
get_task |
Retrieves the latest task object for the specified task and version |
get_tasks |
Retrieves the latest Khiops tasks compatible with the specified version |
get_task_end_version |
Returns the version where the support of the specified task ended |
set_task_end_version |
Sets the version where the support of the specified task ended |
| ATTRIBUTE | DESCRIPTION |
|---|---|
latest_intro_version |
KhiopsVersion : Latest introduction version overall tasks
|
task_names |
list of str: Names of all task families
|
Attributes
latest_intro_version
property
KhiopsVersion : Latest introduction version overall tasks
task_names
property
list of str: Names of all task families
Methods:
get_task(task_name, target_version)
Retrieves the latest task object for the specified task and version
| PARAMETER | DESCRIPTION |
|---|---|
task_name
|
The name of the task to be retrieved.
TYPE:
|
target_version
|
The target Khiops version.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
KhiopsTask
|
The latest task object for the specified task and version. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If there are no tasks registered with the specified name. |
get_tasks(target_version)
Retrieves the latest Khiops tasks compatible with the specified version
| PARAMETER | DESCRIPTION |
|---|---|
target_version
|
The target Khiops version for the tasks to be retrieved.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list of KhiopsTask
|
The list of compatible tasks with |
get_task_end_version(task_name)
Returns the version where the support of the specified task ended
| PARAMETER | DESCRIPTION |
|---|---|
task_name
|
Name of the task.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
KhiopsVersion or None
|
Either the end version for this task or None if it is still supported. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If |
ValueError
|
If there are no registered tasks with the specified name. |
set_task_end_version(task_name, end_version)
Sets the version where the support of the specified task ended
| PARAMETER | DESCRIPTION |
|---|---|
task_name
|
Name of the task.
TYPE:
|
end_version
|
Version where the support of the specified task ended.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
|
ValueError
|
If there are no registered tasks with the specified name. |
Functions:
encode_path_valued_arg(arg, arg_name, arg_type)
Encodes an argument containing paths (str or dict) Adds trailing comment for ensuring URI parsing by Khiops.
| PARAMETER | DESCRIPTION |
|---|---|
arg
|
The value of a path valued argument. |
arg_name
|
The name of the argument.
TYPE:
|
arg_type
|
The type of the argument. Must be either StringLikeType or DictType[ StringLikeType , StringLikeType] .
TYPE:
|
See Also
.encode_path_valued_arg : The underlying transformation function.
get_task_registry()
Direct access to the registry