promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[BUG] Runtime with Custom Environment creates a non matching Custom Application on Compute instance

Open danigian opened this issue 3 years ago • 4 comments

Describe the bug While creating a new Runtime using a custom environment, we noticed that the Custom Application being created on the compute instance has a name mismatch compared to what the Runtime is actually declaring.

As a consequence, as soon as we submit a run from PFClient targeting the runtime, we get the following error:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/promptflow/azure/_restclient/flow_service_caller.py", line 58, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/promptflow/azure/_restclient/flow_service_caller.py", line 416, in submit_bulk_run
    return self.caller.bulk_runs.submit_bulk_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/promptflow/azure/_restclient/flow/operations/_bulk_runs_operations.py", line 370, in submit_bulk_run
    raise HttpResponseError(response=response, model=error)
azure.core.exceptions.HttpResponseError: (UserError) FlowRuntime Runtime[20](https://github.com/REDACTED/actions/runs/6721156406/job/18266254512#step:7:21)[23](https://github.com/REDACTED/actions/runs/6721156406/job/18266254512#step:7:24)1101T1500OnNew in compute instance MIComputeNew is not ready: custom application runtime20231101t1500onnew-202311011446[26](https://github.com/REDACTED/actions/runs/6721156406/job/18266254512#step:7:27)441 in MIComputeNew not found
Code: UserError
Message: FlowRuntime Runtime202[31](https://github.com/REDACTED/actions/runs/6721156406/job/18266254512#step:7:32)101T1500OnNew in compute instance MIComputeNew is not ready: custom application runtime20231101t1500onnew-20231101144626441 in MIComputeNew not found

The Custom Application that gets created instead is named runtime20231101t1500onnew-20231101144648631

Screenshots If applicable, add screenshots to help explain your problem.

Running Information(please complete the following information):

  • Promptflow Package Version using pf -v: 0.1.0b8
  • Operating System: Debian 11
  • Python Version using python --version: 3.11.6

danigian avatar Nov 01 '23 14:11 danigian

@danigian the runtime name and custom application name are not guaranteed to be the same. When you use the runtime, please specify the runtime name instead of the custom application name.

DaweiCai avatar Nov 07 '23 03:11 DaweiCai

@DaweiCai sorry for the confusion my original post might have brought to you. Let me try to explain with more details.

We are actually targeting the runtime by name in the PFClient, but it can't apparently properly resolve it.

When I do a GET to https://ml.azure.com/api/westeurope/flow/api/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.MachineLearningServices/workspaces/REDACTED/FlowRuntimes/runtime20231107t1519?asyncCall=true it returns:

{
    "runtimeName": "runtime20231107t1519",
    "runtimeType": "ComputeInstance",
    "environment": "azureml://locations/westeurope/workspaces/REDACTED/environments/CustomEnvironment20231030v3/versions/1",
    "status": "Unavailable",
    "statusMessage": "Runtime creation in progress",
    "fromExistingEndpoint": false,
    "fromExistingDeployment": false,
    "instanceCount": 1,
    "computeInstanceName": "mycomputeinstance",
    "publishedPort": 0,
    "targetPort": 8080,
    "fromExistingCustomApp": false,
    "customAppName": "runtime20231107t1519-20231107141959379",
    "createdOn": "2023-11-07T14:19:59.3793257+00:00",
    "modifiedOn": "2023-11-07T14:19:59.3793257+00:00",
    "owner": {
        "userObjectId": "REDACTED",
        "userTenantId": "REDACTED",
        "userName": "REDACTED"
    }
}

where you can see customAppName is runtime20231107t1519-20231107141959379.

If I do a GET to https://management.azure.com/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.MachineLearningServices/workspaces/REDACTED/computes/mycomputeinstance?api-version=2023-10-01 I receive the following:

{
    "type": "docker",
    "name": "runtime20231107t1519-20231107142023183",
    "image": {
        "type": "azureml",
        "reference": "CustomEnvironment20231030v3",
        "version": "1"
    },
    "environmentVariables": {
        "PRT_CONFIG_OVERRIDE": {
            "type": "local",
            "value": "storage.storage_account=REDACTED,deployment.subscription_id=REDACTED,deployment.resource_group=REDACTED,deployment.workspace_name=REDACTED,deployment.endpoint_name=REDACTED,deployment.deployment_name=runtime20231107t1519-20231107141959379,deployment.mt_service_endpoint=https://westeurope.api.azureml.ms,deployment.runtime_name=Runtime20231107T1519"
        }
    },
    "docker": {
        "privileged": true
    },
    "endpoints": [
        {
            "protocol": "http",
            "name": "connect",
            "target": 8080,
            "published": 8088,
            "hostIp": null
        }
    ],
    "volumes": [],
    "kernel": null
}

where you can see customAppName is runtime20231107t1519-20231107142023183 which is different from the previous one.

From this mismatch, as a consequence, as soon as we submit a run from PFClient, targeting the runtime by its name, I assume the service can't properly resolve the runtime and we get the error from the stacktrace in the original message.

My assumption is also that the reason of the mismatch is due to the fact that the runtime is not properly coming up in my instance (which is another issue I am currently trying to understand and solve)

danigian avatar Nov 07 '23 14:11 danigian

@danigian I see. It seems you have installed multiple runtimes in one compute instance. And the one you tried to use is not available (not even have a custom application setup in the compute instance). The runtime20231107t1519-20231107142023183 returned from the API is another runtime.

Agree with your assumption: My assumption is also that the reason of the mismatch is due to the fact that the runtime is not properly coming up in my instance (which is another issue I am currently trying to understand and solve).

Maybe we can focus on solving the issue why the runtime is not coming up. We are glad to help if you provide more info.

DaweiCai avatar Nov 08 '23 05:11 DaweiCai

Close this bug.

DaweiCai avatar Nov 15 '23 06:11 DaweiCai