Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

squad-get-log-lines: Create log fetching script #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

katieworton
Copy link
Member

Add a script which fetches the logs for a specified group, project list, and suite list over --count number of builds for each group/project combination.

This script will fetch the log parameter for the tests within the group/project/suite combination specified. The logs are placed in the following paths:
logs/<test.name>/<project.slug>/<test.id>

The script can be run by a command of the following format:

python squad-get-log-lines --project linux-next-master --group lkft --suite log-parser-boot log-parser-test --debug

@katieworton
Copy link
Member Author

This still needs an update to the README, but thought I would put this here as-is to get initial feedback.

squad-get-log-lines Outdated Show resolved Hide resolved
squad-get-log-lines Outdated Show resolved Hide resolved
@katieworton katieworton force-pushed the fetch-logs branch 2 times, most recently from 492c619 to ce12bba Compare June 10, 2024 15:09
@katieworton
Copy link
Member Author

@roxell If you could have a look over this script that would be great! In particular, it would be helpful if you could check:

  • Is the directory structure and file naming produced sensible and at the correct granularity for checking logs across different test names and projects?
  • Are the script inputs sensible and easy enough to work with?

Any other feedback also welcome - those were just two things in particular I wasn't sure about when drafting this :)

squad-get-log-lines Show resolved Hide resolved
squad-get-log-lines Show resolved Hide resolved
Path("logs")
/ Path(test.name)
/ Path(project.slug)
/ Path(str(test.id))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the test_id should be a directory and store a file called logline and then you have the option to store the logfiles per testrun somewhere and create a symlink to that logfile inside the test_id directory.
something like
logs/test.name/project.slug/test.id/logline
logs/logfiles/testrun.id.log
ln -s logs/logfiles/testrun.id.log logs/test.name/project.slug/test.id/logfile

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few more patches to this PR (one patch to add support for log file download and a couple to deal with authentication headers for the file downloads).

To summarise, I've:

  • Added support for downloading the full logs
  • When full logs are downloaded, a directory structure is created which creates symlinks to the full logs next to symlinks to all the log lines which came from that full log
  • Tweaked the initial patch slightly so it aligns a bit better with the above changes

I thought this way it would be easier to see the relationship between the original log and all the different log lines that came from that log.

Let me know what you think 👍

Add a script which fetches the logs for a specified group, project list,
and suite list over `--count` number of builds for each group/project
combination.

This script will fetch the log parameter for the tests within the
group/project/suite combination specified. The logs are placed in the
following paths:
`logs/tests/<test.name>/<project.slug>/<test.id>`

The script can be run by a command of the following format:
python squad-get-log-lines --group lkft --projects linux-next-master \
linux-mainline-master linux-stable-rc-linux-5.15.y \
linux-stable-rc-linux-5.10.y linux-stable-rc-linux-6.1.y \
linux-stable-rc-linux-5.4.y linux-stable-rc-linux-6.6.y \
linux-stable-rc-linux-4.19.y --suites log-parser-boot log-parser-test \
--debug

Signed-off-by: Katie Worton <[email protected]>
Add a `--full-log` flag to support downloading the full logs alongside
the log entries for tests.

When this `--full-log` flag is provided, it will download the full log
for each failing test to the following paths:

`logs/testruns/<test.name>/<project.slug>/<testrun.id>/full_log_<testrun.id>`

It will also create a directory which places together symbolic links to
the full log and its associated test log lines. This makes it easier to
see what log lines were extracted from each full log. These symlinks are
placed in the following paths:

`logs/testruns_next_to_tests/<project.slug>/<testrun.id>/`

With the full log symlink being stored in a file `full_log_<testrun.id>`

And the test logs symlinks being stored in `<suite>/<test.id>`

An example of how to run with this flag is:
python squad-get-log-lines --group lkft --projects linux-next-master \
linux-mainline-master linux-stable-rc-linux-5.15.y \
linux-stable-rc-linux-5.10.y linux-stable-rc-linux-6.1.y \
linux-stable-rc-linux-5.4.y linux-stable-rc-linux-6.6.y \
linux-stable-rc-linux-4.19.y --suites log-parser-boot \
log-parser-test --test-count 150 --debug --full-log

Note: the test-count has been limited to 150 in this example to prevent
an excessive number of logs from being downloaded.

Signed-off-by: Katie Worton <[email protected]>
Add support for request headers to get_file to allow authorization
headers to be used in the get requests for downloads.

Signed-off-by: Katie Worton <[email protected]>
Add the SQUAD_TOKEN authorization header to the get_file call to make
requests to download the full logs authenticated.

Signed-off-by: Katie Worton <[email protected]>
action="store_true",
default=False,
help="Download the full log in addition to the log lines.",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be default True ?
We don't really need to pull out any boot/test-log-parser tests lines.
Since that can be done if we just pull out the logfiles and run the logparser locally once.
Then change the regexes and rerun it locally, now you have two different runs of the logparser run that can be compared and see if regex changes was an improvement or not before committing it.

The script will be way simpler if we drop the boot/test-log-parser tests and only pull the complete logfiles.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants