I want to add some key:value pair in metadata of json that POST by notification of job, but I can not figure it out. I had tried add metadata in job defination and test defination, but the back json did not have my data in metadata field, it was just a []. Then I read the lava source code, I find the metadata data are produced by method `get_metadata_dict()` in class `TestJob`. This method is called at method `create_job_data` in class `TestJob`, it creates the json data which will post to callback url. `get_metadata_dict()` check whether there is an attribute `testdata`, but I can not find the place where this attribute‘s assignment. Could someone give me a way to do this? Thanks you very much! 🙏
I can get the job defination in callback json and extract the metadata, but I think it is not elegrant enough.
On Thu, Nov 7, 2024 at 7:56 AM 叶轩 杨 myemailyyxg@gmail.com wrote:
I can get the job defination in callback json and extract the metadata, but I think it is not elegrant enough.
Here is the link to the docs https://validation.linaro.org/static/docs/v2/user-notifications.html The option you're looking for is "dataset". If you set "dataset: all" in your job definition, the metadata from the job should be included in the callback. However as you discovered the metadata dict is empty. I think this is a bug. I'm looking at the code now.
Best Regards, Milosz
lava-users mailing list -- lava-users@lists.lavasoftware.org To unsubscribe send an email to lava-users-leave@lists.lavasoftware.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
On Thu, Nov 7, 2024 at 8:50 AM Milosz Wasilewski milosz.wasilewski@foundries.io wrote:
On Thu, Nov 7, 2024 at 7:56 AM 叶轩 杨 myemailyyxg@gmail.com wrote:
I can get the job defination in callback json and extract the metadata, but I think it is not elegrant enough.
Here is the link to the docs https://validation.linaro.org/static/docs/v2/user-notifications.html The option you're looking for is "dataset". If you set "dataset: all" in your job definition, the metadata from the job should be included in the callback. However as you discovered the metadata dict is empty. I think this is a bug. I'm looking at the code now.
Looks like this was an intentional change. There are 2 commits that remove adding TestData: 6def3f915adb354ffd10dc59406385e6d8b8fc0e - simplifies relation between TestJob and TestData 0f292afdf8715bd086dc1b93b0176bcc4b68d89b - removes adding TestData objects
As a result the TestData table is now empty. I guess the get_metadata_dict() was forgotten. I reported a bug in gitlab: https://gitlab.com/lava/lava/-/issues/669
Best Regards, Milosz
lava-users@lists.lavasoftware.org