Skip to content

Commit

Permalink
Give log messages more sensible levels
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbkr committed Nov 1, 2022
1 parent 4a2262a commit f73a126
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions lib/CITestSetManager.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ method process-worklist() is serial-dedup {
$command.test-set = $ts;
$command.^save;

trace "CITestSetManager: Starting re-test for command: " ~ $command.id;
debug "CITestSetManager: Starting re-test for command: " ~ $command.id;

for $!test-set-listeners.keys {
$_.re-test-test-set($ts)
Expand All @@ -61,7 +61,7 @@ method process-worklist() is serial-dedup {
-> $test-set {
given $test-set.status {
when DB::UNPROCESSED {
trace "CITestSetManager: processing unprocessed " ~ $test-set.id;
debug "CITestSetManager: processing unprocessed " ~ $test-set.id;
my $id = $!source-archive-creator.create-archive($test-set.source-spec);
$test-set.source-archive-id = $id;
$test-set.status = DB::SOURCE_ARCHIVE_CREATED;
Expand All @@ -81,7 +81,7 @@ method process-worklist() is serial-dedup {
}
}
when DB::SOURCE_ARCHIVE_CREATED {
trace "CITestSetManager: processing source_archive_created " ~ $test-set.id;
debug "CITestSetManager: processing source_archive_created " ~ $test-set.id;
for $!test-set-listeners.keys {
$_.new-test-set($test-set)
}
Expand Down
14 changes: 7 additions & 7 deletions lib/GitHubCITestRequester.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ method process-worklist() is serial-dedup {

trace "GitHub: Processing worklist";
for DB::CITestSet.^all.grep(*.status == DB::NEW) -> $test-set {
trace "GitHub: Processing NEW TestSet";
debug "GitHub: Processing NEW TestSet";
my $source-spec = self!determine-source-spec(
pr => $test-set.pr,
project => $test-set.project,
Expand All @@ -249,7 +249,7 @@ method process-worklist() is serial-dedup {
}

for DB::CITest.^all.grep({ .status != .status-pushed }) -> $test {
trace "GitHub: Test status changed: " ~ $test.id ~ " from " ~ $test.status-pushed ~ " to " ~ $test.status;
debug "GitHub: Test status changed: " ~ $test.id ~ " from " ~ $test.status-pushed ~ " to " ~ $test.status;

my $ts = $test.platform-test-set.test-set;

Expand Down Expand Up @@ -290,7 +290,7 @@ method process-worklist() is serial-dedup {
!! $ts.git-url);

if $test.status-pushed == DB::NOT_STARTED {
trace "GitHub: Queueing test { $test.name } ({ $test.id }): { %project-and-repo<project> }/{ %project-and-repo<repo> } { $ts.commit-sha }, status: { $test.status }, { $completed-at // "" } { $conclusion // "" }";
debug "GitHub: Queueing test { $test.name } ({ $test.id }): { %project-and-repo<project> }/{ %project-and-repo<repo> } { $ts.commit-sha }, status: { $test.status }, { $completed-at // "" } { $conclusion // "" }";
$test.github-id = $!github-interface.create-check-run(
owner => %project-and-repo<project>,
repo => %project-and-repo<repo>,
Expand All @@ -305,7 +305,7 @@ method process-worklist() is serial-dedup {
);
}
else {
trace "GitHub: Updating test { $test.name } ({ $test.id }): { %project-and-repo<project> }/{ %project-and-repo<repo> } { $ts.commit-sha }, status: { $test.status-pushed } => { $test.status }, { $completed-at // "" } { $conclusion // "" }";
debug "GitHub: Updating test { $test.name } ({ $test.id }): { %project-and-repo<project> }/{ %project-and-repo<repo> } { $ts.commit-sha }, status: { $test.status-pushed } => { $test.status }, { $completed-at // "" } { $conclusion // "" }";
$!github-interface.update-check-run(
owner => %project-and-repo<project>,
repo => %project-and-repo<repo>,
Expand Down Expand Up @@ -377,7 +377,7 @@ method !determine-source-spec(:$project!, :$git-url!, :$commit-sha!, :$pr --> So
$did-things = True;
}
else {
trace "PR repo doesn't match nomenclature. Won't try branch matching. Slug: " ~ %head-data<slug>;
warning "PR repo doesn't match nomenclature. Won't try branch matching. Slug: " ~ %head-data<slug>;
}
}
if !$did-things {
Expand Down Expand Up @@ -470,7 +470,7 @@ method test-set-done($test-set) {
# GitHub has no concept of a completed check run suite.
# So we don't need to tell GitHub, that we are done.
# So there is nothing to do here.
trace "GitHub: TestSet done: " ~ $test-set.id;
debug "GitHub: TestSet done: " ~ $test-set.id;
# Run process-worklist to possibly merge PRs if a
# merge-on-success is present.
self.process-worklist;
Expand Down Expand Up @@ -500,7 +500,7 @@ method !process-merge-on-success() {
if [&&] $test-set.platform-test-sets.Seq.map({
$_.tests.Seq.map(*.status == DB::SUCCESS)
}) {
trace "GitHub: Doing Merge-on-success for PR: " ~ $pr.number;
debug "GitHub: Doing Merge-on-success for PR: " ~ $pr.number;

my $allowed = False;
for @pr-mcs {
Expand Down
7 changes: 4 additions & 3 deletions lib/OBS.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ method re-test-test-set(DB::CITestSet:D $test-set) {
$_.test-set.id == $test-set.id
});
if $pts {
debug "OBS: Retesting " ~ $pts.id;
$pts.status = DB::PLATFORM_NOT_STARTED;
$pts.obs-started-at = Nil;
$pts.obs-finished-at = Nil;
Expand Down Expand Up @@ -70,7 +71,7 @@ method process-worklist() is serial-dedup {
$_.platform == DB::OBS &&
$_.status == DB::PLATFORM_NOT_STARTED }) {
$running-pts = $_;
trace "OBS: Starting new run: " ~ $running-pts.id;
debug "OBS: Starting new run: " ~ $running-pts.id;

$running-pts.status = DB::PLATFORM_IN_PROGRESS;

Expand Down Expand Up @@ -192,7 +193,7 @@ method process-worklist() is serial-dedup {
$test.status = $status;

if $status (DB::SUCCESS, DB::FAILURE, DB::ABORTED) {
trace "OBS: Test finished: " ~ ($test.id || "new test");
debug "OBS: Test finished: " ~ ($test.id || "new test");
$test.test-finished-at //= DateTime.now;
$test.log //= do {
my $log;
Expand Down Expand Up @@ -239,7 +240,7 @@ method process-worklist() is serial-dedup {
$_.status (DB::NOT_STARTED, DB::IN_PROGRESS)
}) == 0
&& DateTime.now - $running-pts.obs-started-at >= config.obs-min-run-duration {
trace "OBS: TestSet finished: " ~ $running-pts.id;
debug "OBS: TestSet finished: " ~ $running-pts.id;
$running-pts.status = DB::PLATFORM_DONE;
$running-pts.obs-finished-at = DateTime.now;
$running-pts.^save;
Expand Down
6 changes: 3 additions & 3 deletions lib/SourceArchiveCreator.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ method !get-path-for-name($name, :$create-dirs) {
}

method create-archive(SourceSpec $source-spec --> Str) {
trace "SourceArchiveCreator: starting creation: " ~ $source-spec.raku;
debug "SourceArchiveCreator: starting creation: " ~ $source-spec.raku;

$!store-lock.protect: {
sub validate($proc) {
Expand All @@ -125,7 +125,7 @@ method create-archive(SourceSpec $source-spec --> Str) {
$!nqp-dir, $source-spec.nqp-git-url, $source-spec.nqp-commit-sha,
$!moar-dir, $source-spec.moar-git-url, $source-spec.moar-commit-sha
-> $repo-dir, $remote, $commit {
trace "SourceArchiveCreator: working on " ~ $remote ~ " " ~ $commit;
debug "SourceArchiveCreator: working on " ~ $remote ~ " " ~ $commit;

run(qw|git remote rm foobar|,
:cwd($repo-dir), :merge).so;
Expand Down Expand Up @@ -190,7 +190,7 @@ method create-archive(SourceSpec $source-spec --> Str) {
my $id = @shas.join: "_";
my $filepath = self!get-path-for-name: $id ~ '.tar', :create-dirs;

trace "SourceArchiveCreator: now archiving to " ~ $filepath;
debug "SourceArchiveCreator: now archiving to " ~ $filepath;

run("rm", $filepath.relative($!work-dir), :cwd($!work-dir), :merge).so;
validate run qw|tar -c --exclude-vcs --owner=0 --group=0 --numeric-owner -f|,
Expand Down

0 comments on commit f73a126

Please sign in to comment.