Merge ~hyask/autopkgtest-cloud:skia/always_dump_additional_params into autopkgtest-cloud:master

Proposed by Skia
Status: Merged
Merged at revision: d84eec7c6f61f7e2ef603a93227ccd5a421809d1
Proposed branch: ~hyask/autopkgtest-cloud:skia/always_dump_additional_params
Merge into: autopkgtest-cloud:master
Diff against target: 75 lines (+17/-18)
1 file modified
charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker (+17/-18)
Reviewer Review Type Date Requested Status
Tim Andersson Approve
Review via email: mp+460240@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Skia (hyask) wrote (last edit ):
Download full text (4.0 KiB)

Tested on staging: https://autopkgtest.staging.ubuntu.com/packages/mawk/mantic/amd64

Without all-proposed:
```
❯ curl https://autopkgtest.staging.ubuntu.com/results/autopkgtest-mantic/mantic/amd64/m/mawk/20240208_114537_49781@/artifacts.tar.gz 2>/dev/null | tar xvzOf - testinfo.json
testinfo.json
{
 "virt_server": "autopkgtest-virt-ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor stag-cpu2-ram4-disk20 --security-groups <email address hidden> --name 'adt-mantic-amd64-mawk-20240208-114009-juju-97cf5d-stg-proposed-migration-environment-23-$UUID' --image adt/ubuntu-mantic-amd64-server --keyname testbed-juju-97cf5d-stg-proposed-migration-environment-23 --net-id=net_stg-proposed-migration-environment -e TERM=linux -e ''\"'\"'http_proxy=http://squid.internal:3128'\"'\"'' -e ''\"'\"'https_proxy=http://squid.internal:3128'\"'\"'' -e ''\"'\"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'\"'\"'' --mirror=http://ftpmaster.internal/ubuntu/",
 "kernel_version": "Linux 6.5.0-17-generic #17-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 11 14:01:59 UTC 2024",
 "custom_environment": [
  "ADT_TEST_TRIGGERS=mawk/1.3.4.20230730-1"
 ],
 "nproc": "2",
 "cpu_model": "AMD EPYC-Rome Processor",
 "cpu_flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr wbnoinvd arat npt nrip_save umip rdpid",
 "all-proposed": null
}
```

With all-proposed:
```
❯ curl https://autopkgtest.staging.ubuntu.com/results/autopkgtest-mantic/mantic/amd64/m/mawk/20240208_114848_668c6@/artifacts.tar.gz 2>/dev/null | tar xvzOf - testinfo.json
testinfo.json
{
 "virt_server": "autopkgtest-virt-ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor stag-cpu2-ram4-disk20 --security-groups <email address hidden> --name 'adt-mantic-amd64-mawk-20240208-114538-juju-97cf5d-stg-proposed-migration-environment-23-$UUID' --image adt/ubuntu-mantic-amd64-server --keyname testbed-juju-97cf5d-stg-proposed-migration-environment-23 --net-id=net_stg-proposed-migration-environment -e TERM=linux -e ''\"'\"'http_proxy=http://squid.internal:3128'\"'\"'' -e ''\"'\"'https_proxy=http://squid.internal:3128'\"'\"'' -e ''\"'\"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canoni...

Read more...

Revision history for this message
Tim Andersson (andersson123) wrote :

I think it's better to have all-proposed=0 rather than all-proposed=null. Best they're the same type since multiple snippets of code interact with it

Revision history for this message
Skia (hyask) wrote :

Nothing is relying on `all-proposed` in `testinfo.json` yet, as it was not present until like last week. Moreover, setting this explicitly to 0 means taking a conscious decision to do so even if it was not specified, while `null` is more likely to imply that the option just wasn't given. It's a bit like the modern `Option` and `Result` types in Rust: the type is `int`, but it can be `null` so that you know explicitly there is no value to look for and react accordingly.

Revision history for this message
Tim Andersson (andersson123) wrote :

let's discuss in standup tomorrow maybe

Revision history for this message
Tim Andersson (andersson123) wrote :

Approved once the commit messages have been amended as we just discussed in a call

Revision history for this message
Tim Andersson (andersson123) wrote :

Yeeeeeee boy! LGTM. See if CI passes or tempfails then feel free to merge.

review: Approve
Revision history for this message
Skia (hyask) wrote :

CI again had some random transient failures, I'm merging this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
2index 3744f06..ed85962 100755
3--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
4+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
5@@ -321,9 +321,7 @@ def request_matches_per_package(package, arch, release, s):
6 )
7
8
9-def process_output_dir(
10- dir, pkgname, code, triggers, additional_params: dict = None
11-):
12+def process_output_dir(dir, pkgname, code, triggers, additional_params: dict):
13 """Post-process output directory"""
14
15 files = set(os.listdir(dir))
16@@ -353,14 +351,13 @@ def process_output_dir(
17 json.dump(d, testinfo, indent=True)
18 files.add("testinfo.json")
19
20- if additional_params not in [None, {}]:
21- d = {}
22- with open(os.path.join(dir, "testinfo.json"), "r") as testinfo:
23- d = json.load(testinfo)
24- for key, val in additional_params.items():
25- d[key] = val
26- with open(os.path.join(dir, "testinfo.json"), "w") as testinfo:
27- json.dump(d, testinfo, indent=True)
28+ d = {}
29+ with open(os.path.join(dir, "testinfo.json"), "r") as testinfo:
30+ d = json.load(testinfo)
31+ for key in KEYS_FOR_ADDITIONAL_PARAMS:
32+ d[key] = additional_params.get(key)
33+ with open(os.path.join(dir, "testinfo.json"), "w") as testinfo:
34+ json.dump(d, testinfo, indent=True)
35
36 with open(os.path.join(dir, "testpkg-version"), "r") as tpv:
37 testpkg_version = tpv.read().split()[1]
38@@ -1250,20 +1247,17 @@ def request(msg):
39 # List of key=value strings to be sent as a rabbitmq msg
40 # These variables are optional additional parameters users
41 # can employ when requesting a test which alters the behaviour
42- additional_parameters = []
43- # We also create it as a dict to easily insert into a json file
44- additional_parameters_for_testinfo = {}
45+ additional_parameters = {}
46 for key in KEYS_FOR_ADDITIONAL_PARAMS:
47 if params.get(key, None) is not None:
48- additional_parameters.append("%s=%s" % (key, params[key]))
49- additional_parameters_for_testinfo[key] = params[key]
50+ additional_parameters[key] = params[key]
51
52 (testpkg_version, duration, requester) = process_output_dir(
53 out_dir,
54 pkgname,
55 code,
56 params.get("triggers", []),
57- additional_parameters_for_testinfo, # embed additional parameters in testinfo.json
58+ additional_parameters, # embed additional parameters in testinfo.json
59 )
60
61 # If two tests for the same package with different triggers finish at the
62@@ -1386,7 +1380,12 @@ def request(msg):
63 "requester": requester,
64 "swift_dir": swift_dir,
65 "triggers": triggers,
66- "env": ",".join(additional_parameters),
67+ "env": ",".join(
68+ [
69+ f"{key}={value}"
70+ for key, value in additional_parameters.items()
71+ ]
72+ ),
73 }
74 )
75 complete_amqp.basic_publish(

Subscribers

People subscribed via source and target branches