From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 3/3] jobs: rename function to better distinguish job state and task status
Date: Thu, 11 Nov 2021 16:17:45 +0100 [thread overview]
Message-ID: <20211111151745.130818-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20211111151745.130818-1-f.ebner@proxmox.com>
Also, default to 'internal error' if the task status within the lock
is undef, which shouldn't actually be possible.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/Jobs.pm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/PVE/Jobs.pm b/PVE/Jobs.pm
index bfccf7f1..b91d6158 100644
--- a/PVE/Jobs.pm
+++ b/PVE/Jobs.pm
@@ -54,7 +54,7 @@ sub lock_job_state {
return $res;
}
-my $get_job_status = sub {
+my $get_job_task_status = sub {
my ($state) = @_;
if (!defined($state->{upid})) {
@@ -82,17 +82,15 @@ sub update_job_stopped {
my $state = read_job_state($jobid, $type);
return if !defined($state) || $state->{state} ne 'started'; # removed or not started
- if (defined($get_job_status->($state))) {
+ if (defined($get_job_task_status->($state))) {
lock_job_state($jobid, $type, sub {
my $state = read_job_state($jobid, $type);
return if !defined($state) || $state->{state} ne 'started'; # removed or not started
- my $status = $get_job_status->($state);
-
my $new_state = {
state => 'stopped',
- msg => $status,
- upid => $state->{upid}
+ msg => $get_job_task_status->($state) // 'internal error',
+ upid => $state->{upid},
};
if ($state->{updated}) { # save updated time stamp
--
2.30.2
next prev parent reply other threads:[~2021-11-11 15:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 15:17 [pve-devel] [PATCH-SERIES manager] small cleanups for scheduler/jobs Fabian Ebner
2021-11-11 15:17 ` [pve-devel] [PATCH manager 1/3] pvescheduler: simplify code for sleep time calculation Fabian Ebner
2021-11-11 15:17 ` [pve-devel] [PATCH manager 2/3] jobs: started_job: rename variable to $msg Fabian Ebner
2021-11-11 15:17 ` Fabian Ebner [this message]
2021-11-11 20:06 ` [pve-devel] applied-series: [PATCH-SERIES manager] small cleanups for scheduler/jobs 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=20211111151745.130818-4-f.ebner@proxmox.com \
--to=f.ebner@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