From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager v2 1/3] fix #4026: add 'repeat-missed' option for jobs
Date: Mon, 13 Jun 2022 14:32:16 +0200 [thread overview]
Message-ID: <f9febb90-0dc3-49d9-47cf-f2f7e6e95cac@proxmox.com> (raw)
In-Reply-To: <20220602074206.814493-2-d.csapak@proxmox.com>
Am 02.06.22 um 09:42 schrieb Dominik Csapak:
> diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm
> index 5d36789a..ced48977 100644
> --- a/PVE/API2/Backup.pm
> +++ b/PVE/API2/Backup.pm
> @@ -180,6 +180,13 @@ __PACKAGE__->register_method({
> description => "Enable or disable the job.",
> default => '1',
> },
> + 'repeat-missed' => {
> + optional => 1,
> + type => 'boolean',
> + description => "If true, the job will be run as soon as possible if it was missed while".
> + " the scheduler was not running.",
Style nit: Line too long and continuation should be indented once more.
> + default => 0,
> + },
> comment => {
> optional => 1,
> type => 'string',
> @@ -381,6 +388,13 @@ __PACKAGE__->register_method({
> description => "Enable or disable the job.",
> default => '1',
> },
> + 'repeat-missed' => {
> + optional => 1,
> + type => 'boolean',
> + description => "If true, the job will be run as soon as possible if it was missed while".
> + " the scheduler was not running.",
Same here.
> + default => 0,
> + },
> comment => {
> optional => 1,
> type => 'string',
> diff --git a/PVE/Jobs.pm b/PVE/Jobs.pm
> index da648630..ac44df00 100644
> --- a/PVE/Jobs.pm
> +++ b/PVE/Jobs.pm
> @@ -209,6 +209,7 @@ sub get_last_runtime {
> }
>
> sub run_jobs {
> + my ($first_run) = @_;
Style nit: could use a blank line
> synchronize_job_states_with_config();
>
> my $jobs_cfg = cfs_read_file('jobs.cfg');
> @@ -228,6 +229,10 @@ sub run_jobs {
> next;
> }
>
> + # update last_run_time on the first run when 'repeat-missed' is 0, so that a missed job will not
What is last_run_time ;)?
Style nit: line too long.
> + # start immediately after boot
> + updated_job_schedule($id, $type) if $first_run && !$cfg->{'repeat-missed'};
Can we rename the function? updated_job_schedule() sounds like something
that's only called when the job schedule was updated (and the next patch
introduces yet another code path calling it).
> +
> next if defined($cfg->{enabled}) && !$cfg->{enabled}; # only schedule actually enabled jobs
>
> my $last_run = get_last_runtime($id, $type);
> diff --git a/PVE/Jobs/Plugin.pm b/PVE/Jobs/Plugin.pm
> index 6098360b..b8cbef1e 100644
> --- a/PVE/Jobs/Plugin.pm
> +++ b/PVE/Jobs/Plugin.pm
> @@ -39,6 +39,13 @@ my $defaultData = {
> description => "Description for the Job.",
> maxLength => 512,
> },
> + 'repeat-missed' => {
> + optional => 1,
> + type => 'boolean',
> + description => "If true, the job will be run as soon as possible if it was missed while".
Style nit: also one char too long.
> + " the scheduler was not running.",
> + default => 0,
Do we plan to change the behavior for replication jobs in the future
too? Otherwise, the documented default here will not apply to those.
> + },
> },
> };
>
next prev parent reply other threads:[~2022-06-13 12:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 7:42 [pve-devel] [PATCH manager/docs v2] handle missed jobs better Dominik Csapak
2022-06-02 7:42 ` [pve-devel] [PATCH manager v2 1/3] fix #4026: add 'repeat-missed' option for jobs Dominik Csapak
2022-06-13 12:32 ` Fabian Ebner [this message]
2022-06-02 7:42 ` [pve-devel] [PATCH manager v2 2/3] fix #4053: don't run vzdump jobs when they change from disabled->enabled Dominik Csapak
2022-07-13 11:10 ` Fabian Ebner
2022-07-13 11:13 ` Dominik Csapak
2022-06-02 7:42 ` [pve-devel] [PATCH manager v2 3/3] ui: dc/Backup: add 'repeat-missed' checkbox Dominik Csapak
2022-06-02 7:42 ` [pve-devel] [PATCH docs v2 1/1] vzdump: add section about 'repeat-missed' Dominik Csapak
2022-06-13 12:32 ` [pve-devel] [PATCH manager/docs v2] handle missed jobs better Fabian Ebner
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=f9febb90-0dc3-49d9-47cf-f2f7e6e95cac@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=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 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.