kernelfoundry.eval_pipeline.tasks.task_runner

Task execution dispatcher for managing kernel compilation and testing jobs.

Provides the TaskRunner class which coordinates task execution either locally or via Celery queue, handling build and test steps with optional containerization.

Classes

TaskRunner()

Task execution manager and dispatcher.

class kernelfoundry.eval_pipeline.tasks.task_runner.TaskRunner[source]

Task execution manager and dispatcher.

app = None
classmethod init(use_queue: bool = False)[source]
classmethod build_custom_task(task: Task) Task[source]

Builds the custom task if it has a build step.

Parameters:

task (Task) – The custom task to build.

Returns:

The custom task with the build artifacts included.

Return type:

Task

classmethod build_image(task: Task) dict[str, dict[str, BuildResult]][source]

Builds a container image for the custom task.

Parameters:

task (Task) – The custom task whose environment image should be built.

Returns:

{gpu_arch: BuildResult}} where BuildResult.result.output_data contains ‘image_id’ on success.

Return type:

dict of format {language

Raises:

RuntimeError – If the image build fails.

classmethod pull_image(image_id: str, registry: str | None, allowed_container_registries: list[str] | None, queue: str, timeout: int = 3600) tuple[str | None, str, ProcessResult][source]

Pulls a container image on a worker.

Parameters:
  • image_id – The image ID or fully-qualified image name to pull.

  • registry – The container registry to use for pulling the image.

  • queue – The queue to submit the pull task to.

  • timeout – The maximum time in seconds to wait for the pull to complete.

Returns:

A tuple of (image_id or None on failure, worker hostname, ProcessResult).

classmethod test_custom_task(task: Task, gpu_arch: str | None = None) dict[str, TestResult][source]

Executes the custom task.

Parameters:

task (Task) – The custom task to execute.

Returns:

The results of the custom task execution.

Return type:

dict

classmethod test_sleep(duration: float, message: str, queue: str, get_timeout: float = 30) str[source]

A simple test function to sleep for a given duration.

Parameters:
  • duration (float) – The duration to sleep in seconds.

  • message (str) – The message to return after sleeping.

  • queue (str) – The queue to submit the task to.

  • get_timeout (float) – Timeout for getting the result.

Returns:

Hostname of the worker that executed the task.

Return type:

str