ovsrobot / pw-ci

A patchwork2 integrated CI system
GNU General Public License v2.0
3 stars 6 forks source link

Incomplete series should be retired after some time. #14

Open igsilya opened 7 months ago

igsilya commented 7 months ago

If one of the emails never arrived or the submitter messed up the set while sending, pw_mon will check on it every time and it will never be marked as completed. For example, ovsrobot still waits for a patch 1/2 to arrive for the 3-years old set https://patchwork.ozlabs.org/project/openvswitch/list/?series=269592&state=* and about 35 other similar sets, making 36 unnecessary requests to patchwork.

Retiring the set if the date is older than a month and the series is still incomplete might be a reasonable option. The series API has a "date" field.

apconole commented 7 months ago

I guess we could do something like the following:

diff --git a/pw_mon b/pw_mon
index 068fe1a..11b683f 100755
--- a/pw_mon
+++ b/pw_mon
@@ -162,10 +162,20 @@ function check_new_series() {
 function check_completed_series() {
     get_uncompleted_jobs_as_line "$pw_instance" "$pw_project" | while IFS=\| read -r id url submitter_name submitter_email; do
         echo "Checking on series: $id"
-        local RESPONSE=$(curl -A "(pw-ci) pw-mon-${PROJECT}" -s "$userpw" "$url" | jq -rc '.received_all')
-        if [ "$RESPONSE" = "true" ]; then
+        local RESPONSE=$(curl -A "(pw-ci) pw-mon-${PROJECT}" -s "$userpw" "$url")
+        local RECEIVED=$(echo "$RESPONSE" | jq -rc '.received_all')
+        if [ "$RECEIVED" = "true" ]; then
             echo "Setting series $id to completed"
             series_id_set_complete "$pw_instance" "$id"
+        else
+            local SERIES_DATE=$(echo "$RESPONSE" | jq -rc '.date')
+            local EXPIRY=$(date -d "$SERIES_DATE + 1 month" +%s)
+            local CUR_DATE=$(date -d "today" +%s)
+
+            if [ $EXPIRY -gt $CUR_DATE ]; then
+                echo "Clearing series $id to completed as ignoring"
+                series_id_set_complete "$pw_instance" "$id"
+            fi
         fi
     done
     return 0
@@ -191,6 +201,7 @@ function check_superseded_series() {
              -o "$patch_state" = "changes-requested" -o "$patch_state" = "not-applicable" ]; then
             series_clear_branch "$pw_instance" "$series_id"
             set_synced_for_series "$series_id" "$pw_instance"
+            series_id_set_complete "$pw_instance" "$series_id"
         fi
         echo "Worked on $series_id : state $patch_state"
     done

@Maickii WDYT?

igsilya commented 7 months ago

@apconole will the bot try to build this incomplete set? I suppose such sets shouldn't linger in the 'New' state for long, but things happen.

apconole commented 7 months ago

We can definitely make sure that it won't get built - there's a flag for it