Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions e2e/auditor/test_audit_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import pytest
from nemo_platform import NeMoPlatform
from nemo_platform_plugin.client.adapter import client_from_platform
from nemo_platform_plugin.jobs.client import JobsClient
from nmp.testing import add_mock_provider, short_unique_name

from e2e.auditor.utils import minimal_audit_config, unique_name
Expand Down Expand Up @@ -47,7 +49,7 @@ def _chat_completion(content: str = "I'm happy to help!") -> dict:
def _wait_for_audit_job(sdk: NeMoPlatform, job_name: str, workspace: str) -> str:
deadline = time.monotonic() + AUDIT_JOB_TIMEOUT_SECONDS
while time.monotonic() < deadline:
status_resp = sdk.jobs.get_status(name=job_name, workspace=workspace)
status_resp = client_from_platform(sdk, JobsClient).get_job_status(name=job_name, workspace=workspace)
status = str(status_resp.status)
if status in TERMINAL_STATUSES:
return status
Expand All @@ -57,9 +59,10 @@ def _wait_for_audit_job(sdk: NeMoPlatform, job_name: str, workspace: str) -> str

def _cleanup_audit_job(sdk: NeMoPlatform, job_name: str, workspace: str) -> None:
with suppress(Exception):
sdk.jobs.cancel(name=job_name, workspace=workspace)
jobs = client_from_platform(sdk, JobsClient)
jobs.cancel_job(name=job_name, workspace=workspace)
with suppress(Exception):
sdk.jobs.delete(name=job_name, workspace=workspace)
jobs.delete_job(name=job_name, workspace=workspace)


def _add_mock_provider_or_skip(sdk: NeMoPlatform, workspace: str, name: str) -> str:
Expand Down
7 changes: 5 additions & 2 deletions e2e/test_anonymizer_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
)
from nemo_anonymizer_plugin.sdk.resources import AnonymizerPreviewResult
from nemo_platform import NeMoPlatform
from nemo_platform_plugin.client.adapter import client_from_platform
from nemo_platform_plugin.files.client import FilesClient
from nemo_platform_plugin.files.types import CreateFilesetRequest
from nemo_platform_plugin.jobs.client import JobsClient
from nmp.testing import MockProviderResponse, add_mock_provider, short_unique_name

pytestmark = [
Expand Down Expand Up @@ -324,9 +326,10 @@ def _wait_for_anonymizer_job(job: AnonymizerJobResource, *, timeout_seconds: flo

def _cleanup_anonymizer_job(sdk: NeMoPlatform, job_name: str) -> None:
with suppress(Exception):
sdk.jobs.cancel(name=job_name, workspace=sdk.workspace)
jobs = client_from_platform(sdk, JobsClient)
jobs.cancel_job(name=job_name, workspace=sdk.workspace)
with suppress(Exception):
sdk.jobs.delete(name=job_name, workspace=sdk.workspace)
jobs.delete_job(name=job_name, workspace=sdk.workspace)


@pytest.fixture(scope="module")
Expand Down
13 changes: 9 additions & 4 deletions e2e/test_evaluator_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
from nemo_evaluator_sdk.values.scores import JSONScoreParser, RangeScore
from nemo_platform import APIConnectionError, APIStatusError, NeMoPlatform
from nemo_platform.types.inference import ModelProvider
from nemo_platform_plugin.client.adapter import client_from_platform
from nemo_platform_plugin.jobs.client import JobsClient
from nmp.testing import add_mock_provider, short_unique_name, wait_for_model_entity
from nmp.testing.e2e import wait_for_platform_job
from nmp.testing.utils import ensure_passthrough_virtual_model
Expand Down Expand Up @@ -287,9 +289,10 @@ def _create_ready_mock_model(

def _cleanup_evaluator_job(sdk: NeMoPlatform, job_name: str) -> None:
with suppress(Exception):
sdk.jobs.cancel(name=job_name, workspace=sdk.workspace)
jobs = client_from_platform(sdk, JobsClient)
jobs.cancel_job(name=job_name, workspace=sdk.workspace)
with suppress(Exception):
sdk.jobs.delete(name=job_name, workspace=sdk.workspace)
jobs.delete_job(name=job_name, workspace=sdk.workspace)


def _wait_for_evaluator_job(job: EvaluatorJobResource) -> None:
Expand Down Expand Up @@ -869,7 +872,9 @@ def test_gym_agent_evaluate_job_invalid_config_fails(
job = wait_for_platform_job(evaluator_sdk, job_name, evaluator_workspace, timeout=240)
assert job.status.lower() == "error", f"job {job_name!r} ended {job.status!r}"

job_status = evaluator_sdk.jobs.get_status(workspace=evaluator_workspace, name=job_name)
assert job_status.steps[0].status == "error"
job_status = client_from_platform(evaluator_sdk, JobsClient).get_job_status(
workspace=evaluator_workspace, name=job_name
)
assert job_status.data().steps[0].status == "error"
finally:
_cleanup_evaluator_job(evaluator_sdk, job_name)
Loading
Loading