예제 #1
0
def _list_jobs(
    api: CustomObjectsApi,
    namespace: str,
    project: Optional[str] = None,
    table_name: Optional[str] = None,
) -> List[JobInfo]:
    result = []

    # Batch, Streaming Ingestion jobs
    if project and table_name:
        table_name_hash = _generate_project_table_hash(project, table_name)
        response = api.list_namespaced_custom_object(
            **_crd_args(namespace),
            label_selector=f"{LABEL_FEATURE_TABLE_HASH}={table_name_hash}",
        )
    elif project:
        response = api.list_namespaced_custom_object(
            **_crd_args(namespace),
            label_selector=f"{LABEL_PROJECT}={project}",
        )
    else:
        # Retrieval jobs
        response = api.list_namespaced_custom_object(
            **_crd_args(namespace),
            label_selector=LABEL_JOBID,
        )

    for item in response["items"]:
        result.append(_resource_to_job_info(item))
    return result
예제 #2
0
def _list_jobs(api: CustomObjectsApi, namespace: str) -> List[JobInfo]:
    response = api.list_namespaced_custom_object(
        **_crd_args(namespace),
        label_selector=LABEL_JOBID,
    )

    result = []
    for item in response["items"]:
        result.append(_resource_to_job_info(item))
    return result
예제 #3
0
def _list_jobs(api: CustomObjectsApi,
               namespace: str,
               table_name: Optional[str] = None) -> List[JobInfo]:
    result = []

    # Batch, Streaming Ingestion jobs
    if table_name:
        table_name_hash = hashlib.md5(table_name.encode()).hexdigest()
        response = api.list_namespaced_custom_object(
            **_crd_args(namespace),
            label_selector=f"{LABEL_FEATURE_TABLE_HASH}={table_name_hash}",
        )
    else:
        # Retrieval jobs
        response = api.list_namespaced_custom_object(
            **_crd_args(namespace),
            label_selector=LABEL_JOBID,
        )

    for item in response["items"]:
        result.append(_resource_to_job_info(item))
    return result