all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com, pmg-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 1/2] PVE/API2/Tasks: add since/until filter for the task list
Date: Thu, 24 Jun 2021 09:10:12 +0200	[thread overview]
Message-ID: <20210624071016.21013-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210624071016.21013-1-d.csapak@proxmox.com>

similar to pbs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/API2/Tasks.pm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/PVE/API2/Tasks.pm b/PVE/API2/Tasks.pm
index 8f6ab603..8df701e5 100644
--- a/PVE/API2/Tasks.pm
+++ b/PVE/API2/Tasks.pm
@@ -90,6 +90,16 @@ __PACKAGE__->register_method({
 		optional => 1,
 		description => 'List archived, active or all tasks.',
 	    },
+	    since => {
+		type => 'integer',
+		description => "Only list tasks since this UNIX epoch.",
+		optional => 1,
+	    },
+	    until => {
+		type => 'integer',
+		description => "Only list tasks until this UNIX epoch.",
+		optional => 1,
+	    },
 	},
     },
     returns => {
@@ -128,6 +138,8 @@ __PACKAGE__->register_method({
 	my $typefilter = $param->{typefilter};
 	my $errors = $param->{errors} // 0;
 	my $source = $param->{source} // 'archive';
+	my $since = $param->{since};
+	my $until = $param->{until};
 
 	my $count = 0;
 	my $line;
@@ -145,6 +157,9 @@ __PACKAGE__->register_method({
 	    return 1 if $errors && $task->{status} && $task->{status} eq 'OK';
 	    return 1 if $param->{vmid} && (!$task->{id} || $task->{id} ne $param->{vmid});
 
+	    return 1 if defined($since) && $task->{starttime} < $since;
+	    return 1 if defined($until) && $task->{starttime} > $until;
+
 	    return 1 if $count++ < $start;
 	    return 1 if $limit <= 0;
 
-- 
2.20.1





WARNING: multiple messages have this Message-ID
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com, pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH manager 1/2] PVE/API2/Tasks: add since/until filter for the task list
Date: Thu, 24 Jun 2021 09:10:12 +0200	[thread overview]
Message-ID: <20210624071016.21013-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210624071016.21013-1-d.csapak@proxmox.com>

similar to pbs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/API2/Tasks.pm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/PVE/API2/Tasks.pm b/PVE/API2/Tasks.pm
index 8f6ab603..8df701e5 100644
--- a/PVE/API2/Tasks.pm
+++ b/PVE/API2/Tasks.pm
@@ -90,6 +90,16 @@ __PACKAGE__->register_method({
 		optional => 1,
 		description => 'List archived, active or all tasks.',
 	    },
+	    since => {
+		type => 'integer',
+		description => "Only list tasks since this UNIX epoch.",
+		optional => 1,
+	    },
+	    until => {
+		type => 'integer',
+		description => "Only list tasks until this UNIX epoch.",
+		optional => 1,
+	    },
 	},
     },
     returns => {
@@ -128,6 +138,8 @@ __PACKAGE__->register_method({
 	my $typefilter = $param->{typefilter};
 	my $errors = $param->{errors} // 0;
 	my $source = $param->{source} // 'archive';
+	my $since = $param->{since};
+	my $until = $param->{until};
 
 	my $count = 0;
 	my $line;
@@ -145,6 +157,9 @@ __PACKAGE__->register_method({
 	    return 1 if $errors && $task->{status} && $task->{status} eq 'OK';
 	    return 1 if $param->{vmid} && (!$task->{id} || $task->{id} ne $param->{vmid});
 
+	    return 1 if defined($since) && $task->{starttime} < $since;
+	    return 1 if defined($until) && $task->{starttime} > $until;
+
 	    return 1 if $count++ < $start;
 	    return 1 if $limit <= 0;
 
-- 
2.20.1





  parent reply	other threads:[~2021-06-24  7:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24  7:10 [pve-devel] [PATCH common/pve-manager/pmg-api] unify task filter api Dominik Csapak
2021-06-24  7:10 ` [pmg-devel] " Dominik Csapak
2021-06-24  7:10 ` [pve-devel] [PATCH common 1/2] PVE/JSONSchema: add pve-task-status-type Dominik Csapak
2021-06-24  7:10   ` [pmg-devel] " Dominik Csapak
2021-06-28 12:59   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-28 12:59     ` [pmg-devel] applied: " Thomas Lamprecht
2021-06-24  7:10 ` [pve-devel] [PATCH common 2/2] PVE/Tools: add 'upid_get_status_type' Dominik Csapak
2021-06-24  7:10   ` [pmg-devel] " Dominik Csapak
2021-06-28 13:06   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-28 13:06     ` [pmg-devel] applied: " Thomas Lamprecht
2021-06-24  7:10 ` Dominik Csapak [this message]
2021-06-24  7:10   ` [pmg-devel] [PATCH manager 1/2] PVE/API2/Tasks: add since/until filter for the task list Dominik Csapak
2021-06-28 15:53   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-28 15:53     ` [pmg-devel] applied: " Thomas Lamprecht
2021-06-24  7:10 ` [pve-devel] [PATCH manager 2/2] PVE/API2/Tasks: add statusfilter to " Dominik Csapak
2021-06-24  7:10   ` [pmg-devel] " Dominik Csapak
2021-06-28 15:53   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-28 15:53     ` [pmg-devel] applied: " Thomas Lamprecht
2021-06-24  7:10 ` [pve-devel] [PATCH pmg-api 1/3] PMG/API2/Tasks: add typefilter Dominik Csapak
2021-06-24  7:10   ` [pmg-devel] " Dominik Csapak
2021-06-24  7:10 ` [pve-devel] [PATCH pmg-api 2/3] PMG/API2/Tasks: add since and until filter Dominik Csapak
2021-06-24  7:10   ` [pmg-devel] " Dominik Csapak
2021-06-24  7:10 ` [pve-devel] [PATCH pmg-api 3/3] PMG/API2/Tasks: add statusfilter Dominik Csapak
2021-06-24  7:10   ` [pmg-devel] " Dominik Csapak
2021-06-28 14:55 ` [pve-devel] partially-applied: [pmg-devel] [PATCH common/pve-manager/pmg-api] unify task filter api Thomas Lamprecht
2021-06-28 14:55   ` [pmg-devel] partially-applied: " Thomas Lamprecht

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=20210624071016.21013-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal