public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2 3/6] pvescheduler: run jobs from jobs.cfg
Date: Mon,  8 Nov 2021 14:07:55 +0100	[thread overview]
Message-ID: <20211108130758.160914-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20211108130758.160914-1-d.csapak@proxmox.com>

PVE/Jobs is responsible to decide if the job must run (e.g. with a
schedule)

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

diff --git a/PVE/Service/pvescheduler.pm b/PVE/Service/pvescheduler.pm
index 96d84e20..a8d548fb 100755
--- a/PVE/Service/pvescheduler.pm
+++ b/PVE/Service/pvescheduler.pm
@@ -6,6 +6,7 @@ use warnings;
 use POSIX qw(WNOHANG);
 use PVE::SafeSyslog;
 use PVE::API2::Replication;
+use PVE::Jobs;
 
 use PVE::Daemon;
 use base qw(PVE::Daemon);
@@ -51,19 +52,31 @@ sub run {
 	$old_sig_chld->(@_) if $old_sig_chld;
     };
 
-    my $run_jobs = sub {
+    my $fork = sub {
+	my ($sub) = @_;
 	my $child = fork();
 	if (!defined($child)) {
 	    die "fork failed: $!\n";
 	} elsif ($child == 0) {
 	    $self->after_fork_cleanup();
-	    PVE::API2::Replication::run_jobs(undef, sub {}, 0, 1);
+	    $sub->();
 	    POSIX::_exit(0);
 	}
 
 	$jobs->{$child} = 1;
     };
 
+    my $run_jobs = sub {
+
+	$fork->(sub {
+	    PVE::API2::Replication::run_jobs(undef, sub {}, 0, 1);
+	});
+
+	$fork->(sub {
+	    PVE::Jobs::run_jobs();
+	});
+    };
+
     PVE::Jobs::setup_dirs();
 
     for (my $count = 1000;;$count++) {
-- 
2.30.2





  parent reply	other threads:[~2021-11-08 13:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 13:07 [pve-devel] [PATCH cluster/manager v2] add scheduling daemon for pvesr + vzdump (and more) Dominik Csapak
2021-11-08 13:07 ` [pve-devel] [PATCH cluster v2 1/1] add 'jobs.cfg' to observed files Dominik Csapak
2021-11-09 17:18   ` [pve-devel] applied: " Thomas Lamprecht
2021-11-08 13:07 ` [pve-devel] [PATCH manager v2 1/6] replace systemd timer with pvescheduler daemon Dominik Csapak
2021-11-08 13:07 ` [pve-devel] [PATCH manager v2 2/6] add PVE/Jobs to handle VZDump jobs Dominik Csapak
2021-11-08 13:07 ` Dominik Csapak [this message]
2021-11-08 13:07 ` [pve-devel] [PATCH manager v2 4/6] api/backup: refactor string for all days Dominik Csapak
2021-11-08 13:07 ` [pve-devel] [PATCH manager v2 5/6] api/backup: handle new vzdump jobs Dominik Csapak
2021-11-08 13:07 ` [pve-devel] [PATCH manager v2 6/6] ui: dc/backup: show id+schedule instead of dow+starttime Dominik Csapak
2021-11-09 14:17 ` [pve-devel] [PATCH cluster/manager v2] add scheduling daemon for pvesr + vzdump (and more) Dylan Whyte
2021-11-10  9:38   ` Dominik Csapak
2021-11-10 11:05     ` Thomas Lamprecht
2021-11-09 16:55 ` Aaron Lauterer
2021-11-10 20:42 ` [pve-devel] applied-series: " Thomas Lamprecht
2021-11-11 11:35 ` [pve-devel] " Fabian Ebner
2021-11-11 11:46   ` Dominik Csapak

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=20211108130758.160914-5-d.csapak@proxmox.com \
    --to=d.csapak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal