Skip to navigation

nemo_gym.tasks.harbor.task

View as Markdown

Load one task folder, or a folder of task folders, from disk.

Module Contents

Classes

NameDescription
HarborTaskA task folder read into memory.
HarborTaskErrorThe folder is not a runnable Harbor task.

Functions

NameDescription
discover_tasksA folder with task.toml is one task; otherwise its direct children are the tasks.
is_task_folder-
load_taskRead path as one task. Raises HarborTaskError when it is not one.

Data

INSTRUCTION_FILE

TASK_FILE

logger

API

class nemo_gym.tasks.harbor.HarborTask(
path: pathlib.Path,
task_id: str,
instruction: str,
digest: str,
image: str | None,
workdir: str | None,
env: dict[str, str],
user: str | None
)
Dataclass

A task folder read into memory.

task_id is the folder name: [task].name is an org/name label that is not unique across a dataset. image is the prebuilt image when the task declares one, else the base image of a base-image-only Dockerfile, else None (a build is required). Without a prebuilt image, workdir, env and user merge task.toml with what the Dockerfile recorded; task.toml wins. With a prebuilt image, the Dockerfile contributes no settings.

config
HarborTaskConfig
digest
str
env
dict[str, str]
has_solution
bool
image
str | None
instruction
str
needs_sandbox
bool

A task runs in a sandbox exactly when it declares an image or a Dockerfile.

path
Path
task_id
str
user
str | None
workdir
str | None
class nemo_gym.tasks.harbor.task.HarborTaskError()

Bases: ValueError

The folder is not a runnable Harbor task.

nemo_gym.tasks.harbor.discover_tasks(
root: pathlib.Path,
skipped: dict[str, nemo_gym.tasks.harbor.task.HarborTaskError] | None = None

A folder with task.toml is one task; otherwise its direct children are the tasks.

With skipped, a child that fails to load is recorded there under its folder name and the others still load; without it the first failure raises. A root that is itself a task always raises.

nemo_gym.tasks.harbor.task.is_task_folder(
path: pathlib.Path
) -> bool
nemo_gym.tasks.harbor.load_task(
path: pathlib.Path

Read path as one task. Raises HarborTaskError when it is not one.

nemo_gym.tasks.harbor.task.INSTRUCTION_FILE = 'instruction.md'
nemo_gym.tasks.harbor.task.TASK_FILE = 'task.toml'
nemo_gym.tasks.harbor.task.logger = logging.getLogger(__name__)