DPDK CI discussions
 help / color / mirror / Atom feed
From: Ali Alnubani <alialnu@oss.nvidia.com>
To: <ci@dpdk.org>
Cc: <thomas@monjalon.net>, <jerinj@marvell.com>,
	<ferruh.yigit@intel.com>, <david.marchand@redhat.com>,
	<juraj.linkes@pantheon.tech>
Subject: [dpdk-ci] [PATCH v3 10/10] tools: skip the IDs we already fetched
Date: Mon, 18 Oct 2021 10:45:00 +0300
Message-ID: <20211018074500.16199-11-alialnu@nvidia.com> (raw)
In-Reply-To: <20211018074500.16199-1-alialnu@nvidia.com>

To avoid calling 'callcmd' more than once for an ID, which can happen
if a Patchwork ID was created between recording 'date_now' and fetching
the API, store the IDs we already fetched in a file and don't run 'callcmd'
again for any ID that exists in the file.

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
---
 tools/poll-pw | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/poll-pw b/tools/poll-pw
index 1f8db9c..589e356 100755
--- a/tools/poll-pw
+++ b/tools/poll-pw
@@ -66,6 +66,11 @@ if [ ! $? -eq 0 ] ; then
 	exit 1
 fi
 
+poll_pw_ids_file=/tmp/poll_pw_${resource_type}_ids
+if [ ! -f "$poll_pw_ids_file" ] ; then
+	touch $poll_pw_ids_file
+fi
+
 URL="${URL}/events/?category=${resource_type}-completed"
 
 callcmd () # <patchwork id>
@@ -84,7 +89,11 @@ while true ; do
 			| jq "try ( .payload.${resource_type}.id )")
 		[ -z "$(echo $ids | tr -d '\n')" ] && break
 		for id in $ids ; do
+			if grep -q "^${id}$" $poll_pw_ids_file ; then
+				continue
+			fi
 			callcmd $id
+			echo $id >>$poll_pw_ids_file
 		done
 		page=$((page+1))
 	done
-- 
2.25.1


  parent reply	other threads:[~2021-10-18  7:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18  7:44 [dpdk-ci] [PATCH v3 00/10] Automatic patchwork delegation Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 01/10] tools: rename guess_git_tree script Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 02/10] tools: match by tree URL instead of tree name Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 03/10] tools: update script usage Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 04/10] tools: add functionality for detecting tree maintainers Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 05/10] tools: add functionality for setting pw delegates Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 06/10] add git-pw to requirements file Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 07/10] tools: filter new Patchwork IDs by date Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 08/10] tools: support fetching series Ali Alnubani
2021-10-18  7:44 ` [dpdk-ci] [PATCH v3 09/10] tools: filter new patchwork IDs by project name Ali Alnubani
2021-10-18  7:45 ` Ali Alnubani [this message]
2021-10-18  8:06 ` [dpdk-ci] [PATCH v3 00/10] Automatic patchwork delegation Ali Alnubani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211018074500.16199-11-alialnu@nvidia.com \
    --to=alialnu@oss.nvidia.com \
    --cc=ci@dpdk.org \
    --cc=david.marchand@redhat.com \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=juraj.linkes@pantheon.tech \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK CI discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/ci/0 ci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ci ci/ http://inbox.dpdk.org/ci \
		ci@dpdk.org
	public-inbox-index ci

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.ci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git