LinkJob

class LinkJob(job_pb, owner, device, models, date, project_id)

Link job for a collection of models.

A link job should not be constructed directly. It is constructed by the hub client through submit_link_job(), or get_job().

device

The device the QNN context binary is generated for.

Type:

Device

models

The models for the job.

Type:

list[Model]

date

The time this job was submitted.

Type:

datetime

disable_sharing()

Disable all sharing for this job.

回傳型別:

None

download_artifacts_for_type(output_dir, artifact_type)

Downloads all artifacts of a given type for this job.

If the job is not yet complete, this function will block until completion. If the requested artifact type is not available, returns an empty list. Existing files in the output directory will be overwritten.

參數:
  • output_dir (str) -- Directory to save artifacts to. Created if it does not exist.

  • artifact_type (JobArtifactType) -- The type of artifact to download.

回傳:

Paths to the downloaded artifact files.

回傳型別:

list[str]

download_job_logs(output_dir)

Downloads all available log artifacts for this job.

If the job is not yet complete, this function will block until completion.

參數:

output_dir (str) -- Directory to save log files to. Created if it does not exist.

回傳:

Paths to the downloaded log files.

回傳型別:

list[str]

download_results(artifacts_dir)

Returns all the results of a job.

This includes the linked target model.

If the job is not ready, this function will block until completion.

參數:

artifacts_dir (str) -- Directory name where the job artifacts are stored. If the directory does not exist, it is created.

回傳:

Job results.

回傳型別:

LinkJobResult

download_target_model(filename=None)

Returns the downloaded target model, either in memory or as a file.

If the job is not ready, this function will block until completion.

參數:

filename (Optional[str]) -- If filename is specified the target model is downloaded to file, otheriwse to memory.

回傳:

The downloaded target model, filename, or None if the job failed.

回傳型別:

TargetModel | str | None

get_available_artifacts()

Returns the list of artifact types available for download on this job.

If the job is not yet complete, this function will block until completion.

備註

The availability of specific artifact types may change without notice.

回傳:

Available artifact types.

回傳型別:

list[JobArtifactType]

get_sharing()

Get the list of email addresses of users that this job has been shared with.

回傳型別:

list[str]

get_status()

Returns the status of a job.

回傳:

The status of the job

回傳型別:

JobStatus

get_target_model()

Returns the target model object. If the job is not ready, this function will block until completion.

回傳:

The target model object, or None if the job failed.

回傳型別:

TargetModel | None

modify_sharing(add_emails=[], delete_emails=[])

Modifies the list of users that the job is shared with.

All assets (models, datasets, artifacts, etc.) associated with the job will also be shared. For inference and profile jobs, the corresponding compile and link jobs (if any) will also be shared.

回傳型別:

None

set_name(job_name)

Sets the name of a job to the specified value.

回傳型別:

None

property url: str

Returns the URL for the job.

回傳:

The URL for the job.

回傳型別:

str

wait(timeout=None)

Block until this job finishes.

參數:

timeout (Optional[int]) --

If provided, a TimeoutError will be raised after waiting this many seconds.

If None, this client will not time out the job, meaning it will block an indefinite amount of time waiting for the job to finish.

HOWEVER, Qualcomm AI Hub will fail / time out any job a set amount of time after its creation. Therefore, even if timeout is None, the runtime of this method will still have a finite upper bound.

回傳:

The final, "finished" (SUCCESS or FAILED) status for this job.

回傳型別:

str

引發:

TimeoutError -- Raised only if a client-side timeout occurs, when param "timeout" != None. If the Qualcomm AI Hub server times out the job, this error will NOT be raised, and a FAILED job status will be returned instead.