Skip to content

Documentation for PyPortal.Project

Module for Cloud Portal projects.

JobResults dataclass

JobResults(
    jobs: List[Job],
    next: Optional[str] = None,
    limit: Optional[int] = None,
)

Data class used for .get_jobs() response.

Parameters:

Name Type Description Default
jobs List[Job]

List of all the jobs matching the filter (all jobs if no filter was passed)

required
next Optional[str]

Next token for pagination

None
limit Optional[int]

Number of jobs requested in the query

None

Project

Project(
    id: str,
    name: str,
    description: Optional[str],
    logo: Optional[str] = None,
    enabled: Optional[bool] = None,
    job_count: Optional[int] = None,
    processed_seconds: Optional[float] = None,
)

A class encapsulating Cloud Portal Project.

Intended to be initilized via the client, not directly.

Has the following accessible properties
  • name
  • description
  • id
  • enabled
  • job_count
  • processed_seconds

Warning

The job_count, enabled, and processed_seconds properties are not updated in real-time and added only for filtering purposes when the projects are loaded via project get_project and get_projects methods.

For the latest updates run these methods again.

Initialize Project.

Parameters:

Name Type Description Default
id str

Unique project ID.

required
name str

Name of the project.

required
description Optional[str]

Description of the project.

required
logo Optional[str]

Base 64 encoded project logo.

None
enabled Optional[bool]

Enabled status of the project.

None
job_count Optional[int]

Number of jobs in the project.

None
processed_seconds Optional[float]

Total number of processed seconds.

None

delete async

delete() -> bool

Will delete the project if it is empty.

Returns:

Type Description
bool

True if the project deletion was succesful. False, otherwise

Raises:

Type Description
PortalHTTPException

If there was an error while communicating with FacewareTech Portal.

edit async

edit(
    project_name: Optional[str] = None,
    project_description: Optional[str] = None,
    is_project_enabled: Optional[bool] = None,
) -> bool

Edit the project information.

Parameters:

Name Type Description Default
project_name Optional[str]

New project name.

None
project_description Optional[str]

New project description.

None
is_project_enabled Optional[bool]

Whether the project should be enabled or disabled.

None

Returns:

Type Description
bool

True if the project was successfully updated, False otherwise.

Raises:

Type Description
PortalHTTPException

If there was an error while communicating with the FacewareTech Portal.

get_job async

get_job(job_id: str) -> Job

Get a specific job by id.

Parameters:

Name Type Description Default
job_id str

Unique ID to load the job.

required

Returns:

Type Description
Job

Job object.

Raises:

Type Description
PortalHTTPException

If there was an error while communicating with FacewareTech Portal.

InvalidPortalResponseException

If portal responded with invalid or unexpected format.

get_jobs async

get_jobs(
    next: Optional[str] = None,
    limit: Optional[int] = None,
    status: Optional[List[JobStatus]] = None,
) -> JobResults

Get the list of all jobs in the project.

Parameters:

Name Type Description Default
next Optional[str]

the token use for pagination, will be returned with a previous get_jobs() request if the limit was set. Used to load next sequence of the jobs

None
limit Optional[int]

how many jobs to load

None
status Optional[List[JobStatus]]

filter jobs based on the JobStatus

None
Valid filtering statuses
  • JobStatus.IN_PROGRESS
  • JobStatus.QUEUED
  • JobStatus.COMPLETED
  • JobStatus.FAILED

Raises:

Type Description
PortalHTTPException

If there was an error while communicating with FacewareTech Portal.

InvalidPortalResponseException

If portal responded with invalid or unexpected format.

ValueError

If the invalid filterting status provided.

Returns:

Type Description
JobResults

The JobResults object.

submit_job async

submit_job(
    actor_name: str,
    tracking_model: TrackingModel,
    video_file_path: str,
    calibration_image_file_path: Optional[str] = None,
    video_rotation: Optional[VideoRotation] = NONE,
    tracking_version: Optional[str] = None,
    upload_progress_listener: Optional[
        Callable[[float], None]
    ] = None,
) -> Job

Will create new job and submit it for processing.

Parameters:

Name Type Description Default
actor_name str

The name of the actor for this job

required
tracking_model TrackingModel

Select if the video was recorded on Head cam or static cam

required
video_file_path str

Absolute local file system filepath to the video file. File size limit is 5TiB.

required
calibration_image_file_path Optional[str]

Absolute local file system filepath to the calibration image file

None
video_rotation Optional[VideoRotation]

The orientation of the camera when video was recorded.

NONE
tracking_version Optional[str]

Tracking version for Job.

None
upload_progress_listener Optional[Callable[[float], None]]

A callback for tracking the file upload progress.

None
upload_progress_listener example
def progress_listener(progress) -> None:
    print(f"Upload progress: {progress}%")

Raises:

Type Description
TypeError

If the project is disabled.

PortalHTTPException

If there was an error while communicating with FacewareTech Portal.

Returns:

Type Description
Job

Job object.

submit_jobs async

submit_jobs(
    actor_name: str,
    tracking_model: TrackingModel,
    video_files_paths: List[str],
    calibration_image_file_path: Optional[str] = None,
    video_rotation: Optional[VideoRotation] = NONE,
    tracking_version: Optional[str] = None,
    upload_progress_listener: Optional[
        Callable[[float], None]
    ] = None,
) -> List[Job]

Submits multiple jobs for processing video files.

Parameters:

Name Type Description Default
actor_name str

The name of the actor for whom the jobs are being submitted

required
tracking_model TrackingModel

Select if the video was recorded on Head cam or static cam

required
video_files_paths List[str]

A list of absolute local file system filepaths to the video files. File size limit is 5TiB.

required
calibration_image_file_path Optional[str]

Absolute local file system filepath to the calibration image file

None
video_rotation Optional[VideoRotation]

The orientation of the camera when videos were recorded

NONE
tracking_version Optional[str]

Tracking version for Jobs.

None
upload_progress_listener Optional[Callable[[float], None]]

A callback for tracking the file upload progress.

None
upload_progress_listener example
def progress_listener(progress) -> None:
    print(f"Upload progress: {progress}%")

Raises:

Type Description
TypeError

If the project is disabled.

PortalHTTPException

If there was an error while communicating with FacewareTech Portal.

Returns:

Type Description
List[Job]

List of submitted job objects.