You are viewing documentation about an older version (1.8.2). View latest version

snowflake.ml.jobs.MLJob

class snowflake.ml.jobs.MLJob(id: str, service_spec: Optional[Dict[str, Any]] = None, session: Optional[Session] = None)

Bases: Generic[T]

Methods

get_logs(limit: int = - 1, instance_id: Optional[int] = None) str

Return the job’s execution logs.

Parameters:
  • limit – The maximum number of lines to return. Negative values are treated as no limit.

  • instance_id – Optional instance ID to get logs from a specific instance. If not provided, returns logs from the head node.

Returns:

The job’s execution logs.

This function or method is in private preview since 1.7.4.

result(timeout: float = - 1) T

Block until completion. Returns job execution result.

Parameters:

timeout – The maximum time to wait in seconds. Negative values are treated as no timeout.

Returns:

The deserialized job result. # noqa: DAR401

Return type:

T

Raises:
  • RuntimeError – If the job failed or if the job doesn’t have a result to retrieve.

  • TimeoutError – If the job does not complete within the specified timeout. # noqa: DAR402

This function or method is in private preview since 1.8.2.

show_logs(limit: int = - 1, instance_id: Optional[int] = None) None

Display the job’s execution logs.

Parameters:
  • limit – The maximum number of lines to display. Negative values are treated as no limit.

  • instance_id – Optional instance ID to get logs from a specific instance. If not provided, displays logs from the head node.

This function or method is in private preview since 1.7.4.

wait(timeout: float = - 1) Literal['PENDING', 'RUNNING', 'FAILED', 'DONE', 'INTERNAL_ERROR']

Block until completion. Returns completion status.

Parameters:

timeout – The maximum time to wait in seconds. Negative values are treated as no timeout.

Returns:

The job’s completion status.

Raises:

TimeoutError – If the job does not complete within the specified timeout.

This function or method is in private preview since 1.7.4.

Attributes

id

Get the unique job ID

status

Get the job’s execution status.