dlstreamer / pipeline-server

Home of Intel(R) Deep Learning Streamer Pipeline Server (formerly Video Analytics Serving)
BSD 3-Clause "New" or "Revised" License
126 stars 51 forks source link

v0.7.1 client incompatible with earlier versions of the service #107

Closed whbruce closed 2 years ago

whbruce commented 2 years ago

vaclient was updated to use the new "instance only" REST api calls (see "What's Changed" section of release notes). These calls are not supported by older versions of the service so vaclient will fail as follows:

./vaclient/vaclient.sh run object_detection/person_vehicle_bike https://github.com/intel-iot-devkit/sample-videos/blob/master/person-bicycle-car-detection.mp4?raw=true
<snip>
Starting pipeline object_detection/person_vehicle_bike, instance = 1
Got unsuccessful status code: 400
"Invalid Pipeline or Version"
Error in pipeline, please check pipeline-server log messages

Sever log from v0.7.0 or earlier will show the following

{"levelname": "INFO", "asctime": "2022-03-04 05:22:22,474", "message": "Creating Instance of Pipeline object_detection/person_vehicle_bike", "module": "pipeline_manager"}
{"levelname": "WARNING", "asctime": "2022-03-04 05:22:22,507", "message": "Invalid pipeline or version", "module": "pipeline_manager"}
WARNING:tornado.access:400 GET /pipelines/status/1 (172.17.0.1) 1.50ms
{"levelname": "INFO", "asctime": "2022-03-04 05:22:23,707", "message": "Setting Pipeline 1 State to RUNNING", "module": "gstreamer_pipeline"}
{"levelname": "INFO", "asctime": "2022-03-04 05:22:53,955", "message": "Pipeline 1 Ended", "module": "gstreamer_pipeline"}

vaclient has started the pipeline successfully and it will run to completion, it's the status call that has failed.

The simplest workaround is ensure vaclient and the service are using the same container version.

Any client, such as vaclient, that has been updated to use the new "instance only" call (GET /pipelines/status/{instance_id}) will fail in a similar way. As a workaround update client to use legacy status call (GET /pipelines/{name}/{version}/{instance_id}/status) if "instance only" call fails.

For vaclient, this can be done by updating get_pipleline_status as follows. More elegant solutions are possible.

legacy_status_url = None

def get_pipeline_status(server_address, instance_id, show_request=False):
    global legacy_status_url
    status = None
    if not legacy_status_url:
        status_url = urljoin(server_address,
                            "/".join(["pipelines",
                                    "status",
                                    str(instance_id)]))
        status = get(status_url, show_request)
    if status:
        return status
    pipelines_url = urljoin(server_address, "pipelines")
    response = get(pipelines_url, show_request)
    if not response:
        return None
    pipeline = response[0]
    legacy_status_url = urljoin(server_address,
                                "/".join(["pipelines",
                                pipeline["name"],
                                pipeline["version"],
                                str(instance_id),
                                "status"]))
    response = get(legacy_status_url, show_request)
    return response
whbruce commented 2 years ago

Closing as "will not fix" as backward compatibility is not required prior to v1.0.