Skip to content

Commit 0aa9edd

Browse files
committed
Minor fixes for consistent JSON output
1 parent 36825f1 commit 0aa9edd

File tree

2 files changed

+48
-43
lines changed

2 files changed

+48
-43
lines changed

kernel_tuner/file_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,11 @@ def store_metadata_file(metadata_filename: str):
223223
if hardware_description_string[0] == "{" and hardware_description_string[-1] == "}":
224224
# sometimes lshw outputs a list of length 1, sometimes just as a dict, schema wants a list
225225
hardware_description_string = "[" + hardware_description_string + "]"
226-
metadata["hardware"] = dict(hardware_description=json.loads(hardware_description_string))
227226
metadata["operating_system"] = os_string
228227
except:
229-
metadata["hardware"] = "error retrieving hardware description"
228+
hardware_description_string = "[error retrieving hardware description]"
229+
metadata["operating_system"] = "unidentified OS"
230+
metadata["hardware"] = dict(hardware_description=json.loads(hardware_description_string))
230231

231232
# attempts to use nvidia-smi or rocm-smi if present
232233
device_query = {}
Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
{
2-
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://github.com/odgaard/TuningSchema/blob/T4/metadata-schema.json",
4-
"title": "Open Autotuning Metadata Schema",
5-
"type": "object",
6-
"properties": {
7-
"schema_version": {
8-
"description": "The version number of the schema in major.minor.patch format.",
9-
"type": "string",
10-
"pattern": "^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$",
11-
"example": "1.0.0"
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://github.com/odgaard/TuningSchema/blob/T4/metadata-schema.json",
4+
"title": "Open Autotuning Metadata Schema",
5+
"type": "object",
6+
"properties": {
7+
"schema_version": {
8+
"description": "The version number of the schema in major.minor.patch format.",
9+
"type": "string",
10+
"pattern": "^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$",
11+
"example": "1.0.0"
12+
},
13+
"metadata": {
14+
"type": "object",
15+
"properties": {
16+
"zenodo": {
17+
"type": "object",
18+
"description": "The zenodo metadata used to publish the artifact"
1219
},
13-
"metadata": {
14-
"type": "object",
15-
"properties": {
16-
"zenodo": {
17-
"type": "object",
18-
"description": "The zenodo metadata used to publish the artifact"
19-
},
20-
"hardware": {
21-
"type": "object",
22-
"properties": {
23-
"lshw": {
24-
"type": "array",
25-
"description": "The output of lshw as JSON"
26-
}
27-
}
28-
},
29-
"environment": {
30-
"type": "object",
31-
"properties": {
32-
"device_query": {
33-
"type": "object",
34-
"description": "The output from tools such as nvidia-smi as JSON"
35-
},
36-
"requirements": {
37-
"type": "array",
38-
"description": "the python libraries used as a list of strings"
39-
}
40-
}
41-
}
20+
"hardware": {
21+
"type": "object",
22+
"properties": {
23+
"hardware_description": {
24+
"type": "array",
25+
"description": "The hardware description in JSON, OS-dependent (e.g. lshw on Linux)"
26+
},
27+
"operating_system": {
28+
"type": "string",
29+
"description": "The operating system used"
4230
}
31+
}
32+
},
33+
"environment": {
34+
"type": "object",
35+
"properties": {
36+
"device_query": {
37+
"type": "object",
38+
"description": "The output from tools such as nvidia-smi as JSON"
39+
},
40+
"requirements": {
41+
"type": "array",
42+
"description": "the python libraries used as a list of strings"
43+
}
44+
}
4345
}
44-
}
45-
}
46+
}
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)