From 42fd7ff894f5ed689fbfe44dc7e33bc8900b73ca Mon Sep 17 00:00:00 2001 From: Harshil Patel Date: Fri, 3 Nov 2023 13:54:30 -0700 Subject: [PATCH 1/2] stdlib, resources: Update JSON data in workload - resources field in workload now supports a dict with resources id and version. - Older workload JSON are still supported but added a deprecation waring Change-Id: I137dbb99799a5294e84ce7d5d914f05e4cfe9e00 --- src/python/gem5/resources/resource.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/python/gem5/resources/resource.py b/src/python/gem5/resources/resource.py index 96cb5cf19d..ae9ff668ca 100644 --- a/src/python/gem5/resources/resource.py +++ b/src/python/gem5/resources/resource.py @@ -964,10 +964,22 @@ def obtain_resource( for key in resource_json["resources"].keys(): assert isinstance(key, str) value = resource_json["resources"][key] - assert isinstance(value, str) - params[key] = obtain_resource( - value, - ) + + if isinstance(value, str): + warn( + "Deprecation warning: resources field in workloads has changed" + "from { category: id } to" + "{ category: { id: id, resource_version: resource_version } }" + "Please update your resource.json file to reflect this change." + ) + params[key] = obtain_resource( + value, + ) + elif isinstance(value, dict): + params[key] = obtain_resource( + value["id"], + resource_version=value["resource_version"], + ) if "additional_params" in resource_json: for key in resource_json["additional_params"].keys(): assert isinstance(key, str) From 50c9cbf61327f0943810053d671ab1b99c6018d4 Mon Sep 17 00:00:00 2001 From: Harshil Patel Date: Mon, 13 Nov 2023 14:09:13 -0800 Subject: [PATCH 2/2] stdlib, resources: Fixed deprecation warning Change-Id: I61865d9a2c08e344824a735ee5e85fb54cd489da --- src/python/gem5/resources/resource.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/gem5/resources/resource.py b/src/python/gem5/resources/resource.py index ae9ff668ca..98c58cf832 100644 --- a/src/python/gem5/resources/resource.py +++ b/src/python/gem5/resources/resource.py @@ -970,7 +970,8 @@ def obtain_resource( "Deprecation warning: resources field in workloads has changed" "from { category: id } to" "{ category: { id: id, resource_version: resource_version } }" - "Please update your resource.json file to reflect this change." + "The current develop branch of gem5 supports both formats" + "but this will be removed in the 23.1 release." ) params[key] = obtain_resource( value,