@@ -4,21 +4,20 @@ pgpro_scheduler allows to schedule jobs execution and control their activity
4
4
in PostgreSQL database.
5
5
6
6
The job is the set of SQL commands. Schedule table could be described as a
7
- crontab-like
8
- string or as an JSON object. It's possible to use combination of both methods
9
- for scheduling settings.
7
+ crontab-like string or as a JSON object. It's possible to use combination
8
+ of both methods for scheduling settings.
10
9
11
10
Each job could calculate its next start time. The set of SQL commands
12
11
could be executed in the same transaction or each command could be executed in
13
- individual transaction . It's possible to set SQL command to be executed on
12
+ individual one . It's possible to set SQL statement to be executed on
14
13
failure of main job transaction.
15
14
16
15
## Installation
17
16
18
- pgpro_scheduler is a regular PostgreSQL extension and require no prerequisites.
17
+ pgpro_scheduler is a regular PostgreSQL extension and requires no prerequisites.
19
18
20
- Before build extension from source make sure that the evironment variable
21
- PATH includes path to ` pg_config ` utility. Also make sure that you have
19
+ Before build extension from the source make sure that the environment variable
20
+ ` PATH ` includes path to ` pg_config ` utility. Also make sure that you have
22
21
developer version of PostgreSQL installed or PostgrteSQL was built from
23
22
source code.
24
23
@@ -27,7 +26,7 @@ Install extension as follows:
27
26
$ cd pgpro_scheduler
28
27
$ make USE_PGXS=1
29
28
$ sudo make USE_PGXS=1 install
30
- $ psql <DBNAME> -c "CREATE EXTNESION pgpro_scheduler"
29
+ $ psql <DBNAME> -c "CREATE EXTENSION pgpro_scheduler"
31
30
32
31
## Configuration
33
32
@@ -42,21 +41,21 @@ help to handle scheduler configuration.
42
41
* ** schedule.scheme** - text, the ` scheme ` name where scheduler store its
43
42
tables and functions. To change this value restart required. Normally
44
43
you should not change this variable but it could be useful if you
45
- want run scheduled jobs on hot-stanbdy database. So you can define
44
+ want run scheduled jobs on hot-standby database. So you can define
46
45
foreign data wrapper on master system to wrap default scheduler schema
47
46
to another and use it on replica. Default value: schedule.
48
47
* ** schedule.nodename** - text, node name of this instance.
49
48
Default value is `master`. You should not change or use it if you run
50
- single server configuration. But it is neccessary to change this name
49
+ single server configuration. But it is necessary to change this name
51
50
if you run scheduler on hot-standby database.
52
51
* ** schedule.max_workers** - integer, max number of simultaneously running
53
52
jobs for one database. Default value: 2.
54
53
* ** schedule.transaction_state** - text, this is internal variable.
55
54
This variable contains state of executed job. This variable was designed
56
- to use with a next job start time calculationi procedure.
55
+ to use with a next job start time calculation procedure.
57
56
Possible values are:
58
- * **success** - transaction finished successfully
59
- * **failure** - transaction failed to finish
57
+ * **success** - transaction has finished successfully
58
+ * **failure** - transaction has failed to finish
60
59
* **running** - transaction is in progress
61
60
* **undefined** - transaction has not started yet
62
61
@@ -68,7 +67,7 @@ help to handle scheduler configuration.
68
67
You could manage scheduler work by means of PostgreSQL variables described
69
68
above.
70
69
71
- For example, you have a fresh PostgreSQL installation with sheduler extension
70
+ For example, you have a fresh PostgreSQL installation with scheduler extension
72
71
installed. You are going to use scheduler with databases called 'database1' and
73
72
'database2'. You want 'database1' be capable to run 5 jobs in parallel and
74
73
'database2' - 3.
@@ -107,7 +106,7 @@ where:
107
106
108
107
* ** N<sub >min</sub >** - the minimal acceptable amount of bgworkers in the
109
108
system. Consider the fact that other systems need to start background
110
- workers too. E.g. parallel queries. So you need to ajust the value to
109
+ workers too. E.g. parallel queries. So you need to adjust the value to
111
110
their needs either.
112
111
* ** N<sub >databases</sub >** - the number of databases scheduler works with
113
112
* ** MAX_WORKERS<sub >n</sub >** - the value of ` schedule.max_workers `
@@ -217,7 +216,7 @@ Creates job and sets it active.
217
216
218
217
Arguments:
219
218
220
- * ** date** - exect date of execution
219
+ * ** date** - exact date of execution
221
220
* ** sql** - SQL statement to execute
222
221
* ** node** - node name, optional
223
222
@@ -229,7 +228,7 @@ Creates job and sets it active.
229
228
230
229
Arguments:
231
230
232
- * ** date** - exect date of execution
231
+ * ** date** - exec date of execution
233
232
* ** sqls** - set of SQL statements to be executed
234
233
* ** node** - node name, optional
235
234
@@ -265,7 +264,7 @@ Creates job and sets it active.
265
264
266
265
The only argument is a JSONB object with information about job.
267
266
268
- The object coubl contains the following keys, some of them could be omitted:
267
+ The object could contains the following keys, some of them could be omitted:
269
268
270
269
* ** name** - job name;
271
270
* ** node** - node name;
@@ -275,25 +274,25 @@ The object coubl contains the following keys, some of them could be omitted:
275
274
* ** command** - SQL statement to be executed;
276
275
* ** commands** - a set of SQL statements to be executed as an array;
277
276
* ** run\_ as** - user to execute command(s);
278
- * ** start\_ date** - begin of period while command could be executed,
277
+ * ** start\_ date** - begin of period while command can be executed,
279
278
could be NULL;
280
- * ** end\_ date** - end of period while command could be executed,
279
+ * ** end\_ date** - end of period while command can be executed,
281
280
could be NULL;
282
281
* ** date** - exact date when command will be executed;
283
282
* ** dates** - set of exact dates when command will be executed;
284
283
* ** use\_ same\_ transaction** - if set of commands will be executed within
285
284
the same transaction. Default: false;
286
- * ** last\_ start\_ available** - for how long could command execution could be
285
+ * ** last\_ start\_ available** - for how long command execution could be
287
286
postponed if maximum number of allowed workers reached at the scheduled
288
287
moment. Time set in format of `interval`. E.g. '00:02:34' - it is
289
- possible to wait for 2 minutes 34 seconds. If time is NULL or not set will
290
- wait forever. Default: NULL;
291
- * ** max\_ run\_ time** - for how long scheduled job could be executed.
288
+ possible to wait for 2 minutes 34 seconds. If time is NULL or not set
289
+ waits forever. Default: NULL;
290
+ * ** max\_ run\_ time** - for how long scheduled job can be executed.
292
291
Format: `interval`. If NULL or not set - there is no time limits.
293
292
Default: NULL;
294
293
* ** onrollback** - SQL statement to be executed on ROLLBACK if main
295
294
transaction failure. Default: not defined;
296
- * ** next\_ time\_ statement** - SQL statement to caclulate next start time.
295
+ * ** next\_ time\_ statement** - SQL statement to calculate next start time.
297
296
298
297
The rules of scheduling could be set as cron-like string (key ` cron ` ) and
299
298
also as JSONB object (key ` rule ` ).
@@ -311,21 +310,21 @@ This object contains the following keys:
311
310
Also job could be scheduled on exact date or set of dates. Use keys ` date `
312
311
and ` dates ` keys accordingly.
313
312
314
- All scheduling mwthods could be combined but the use at least one of them is
313
+ All scheduling methods could be combined but the use of at least one of them is
315
314
mandatory.
316
315
317
- Key ` next_time_statement ` should contains SQL statment to be executed
318
- after the main transaction to calculate net start time. If key is defined
316
+ Key ` next_time_statement ` may contain SQL statement to be executed
317
+ after the main transaction to calculate next start time. If key is defined
319
318
the first start time will be calculated by methods described above but
320
319
successive start times will be derived from this statement. The statement
321
320
must return record with the first field containing value of type
322
321
` timestamp with time zone ` . If returning value be of the different type or
323
- statement exection produce an error the job will be marked as broken and further
322
+ statement execution produce an error the job will be marked as broken and further
324
323
execution will be prohibited.
325
324
326
- This statment will be executed in spite of main transaction execution state.
325
+ This statement will be executed in spite of main transaction execution state.
327
326
It's possible to get state of main transaction form postgres variable
328
- schedule.transaction_state`.
327
+ ` schedule.transaction_state ` .
329
328
330
329
The possible values are:
331
330
@@ -338,11 +337,11 @@ The last two values should not appear as a value of the key
338
337
` next_time_statement ` within user procedure.
339
338
340
339
SQL statement to be executed could be set in ` command ` or ` commands ` key.
341
- The first one set the single statement, the second the set of statements.
340
+ The first one sets the single statement, the second - the set of statements.
342
341
In fact the first key could contains the set of commands in one string
343
342
divided by semicolon. In this case they all be executed in single transaction
344
343
in spite of the value ` use_same_transaction ` . So for set of the statements
345
- is better to use key ` commands ` key as you get more controll on execution.
344
+ is better to use key ` commands ` key as you get more control on execution.
346
345
347
346
Returns id of created job.
348
347
@@ -375,7 +374,7 @@ Arguments:
375
374
* ** value** - property value
376
375
377
376
The full list of the properties could be found in ` schedule.create_job `
378
- function description. Some values are of array types. This ** value** could
377
+ function description. Some values are of array types. Their ** value** could
379
378
be passed as an array, but if the value could not be an array the exception
380
379
will be raised.
381
380
@@ -416,7 +415,7 @@ Returns true on success, false on failure.
416
415
417
416
### schedule.get_job(job_id integer)
418
417
419
- Retrieves information about the job
418
+ Retrieves information about the job.
420
419
421
420
Arguments:
422
421
@@ -434,12 +433,12 @@ Arguments:
434
433
* ** username** - user name, optional
435
434
436
435
Returns the set of records of type ` cron_rec ` . Records contain information
437
- about jobs owned by user. If user name is not specified session user is
436
+ about jobs owned by user. If user name is omitted the session user name is
438
437
used.
439
438
440
- Retrive jobs owned by another user is allowed only to superuser.
439
+ Retrieve jobs owned by another user is allowed only to superuser.
441
440
442
- Type ` cron_rec ` description can be found in ** SQL type** section.
441
+ ` cron_rec ` type description can be found in ** SQL type** section.
443
442
444
443
### schedule.get_user_cron(username text)
445
444
@@ -453,7 +452,7 @@ Returns the set of records of type `cron_rec`. Records contain information
453
452
about jobs executed as user. If user name is not specified session user is
454
453
used.
455
454
456
- Retrive jobs executed as another user is allowed only to superuser.
455
+ Retrieve jobs executed as another user is allowed only to superuser.
457
456
458
457
Type ` cron_rec ` description can be found in ** SQL type** section.
459
458
@@ -465,47 +464,46 @@ Arguments:
465
464
466
465
* ** username** - user name, optional
467
466
468
- If user name not specified the session user name used. To list jobs executed
467
+ If user name is omitted the session user name used. To list jobs executed
469
468
as another user allowed only to superuser.
470
469
471
470
Return value is set of records of type ` cron_job ` .
472
- See type description in ** SQL types** section.
471
+ See the type description in ** SQL types** section.
473
472
474
473
### schedule.get_active_jobs()
475
474
476
- Функция возвращает список всех задач, которые исполняются в данный момент .
477
- Может быть выполнена только пользователем с правами суперпользователя .
475
+ Returns list of jobs being executed at that very moment .
476
+ The function call allowed only to superuser .
478
477
479
- Задачи возвращаются в виде набора записей типа ` cron_job ` . Описание типа вы
480
- можете найти в разделе ** SQL типы ** .
478
+ Return value is set of records of type ` cron_job ` .
479
+ See the type description in ** SQL types ** section .
481
480
482
481
### schedule.get_log()
483
482
484
- Функция возвращает список всех выполненых задач.
485
- Может быть выполнена только пользователем с правами суперпользователя .
483
+ Returns list of all completed jobs.
484
+ The function call allowed only to superuser .
486
485
487
- Задачи возвращаются в виде набора записей типа ` cron_job ` . Описание типа вы
488
- можете найти в разделе ** SQL типы ** .
486
+ Return value is set of records of type ` cron_job ` .
487
+ See the type description in ** SQL types ** section .
489
488
490
489
### schedule.get_user_log(username text)
491
490
492
- Функция возвращает список всех выполненых задач, которые выполнялись с правами
493
- пользователя, переданного в аргументах.
491
+ Returns list of completed jobs executed as user passed in arguments.
494
492
495
493
Arguments:
496
494
497
- * ** username** - имя пользователя, опционально
495
+ * ** username** - user name, optional
498
496
499
- Если не указано имя пользователя, то используется имя пользователя сессии .
500
- Чужие задачи может просматривать только суперпользователь .
497
+ If username is omitted the session user name used .
498
+ Jobs executed as another users are accessible only to superuser .
501
499
502
- Задачи возвращаются в виде набора записей типа ` cron_job ` . Описание типа вы
503
- можете найти в разделе ** SQL типы ** .
500
+ Return value is set of records of type ` cron_job ` .
501
+ See the type description in ** SQL types ** section .
504
502
505
503
### schedule.clean_log()
506
504
507
- Удаляет все записи о выполненных задачах. Может быть выполнена только с правами
508
- суперпользователя .
505
+ Delete all records with information about completed jobs.
506
+ Can be called by superuser only .
509
507
510
- Возвращает количество удаленных записей
508
+ Returns the number of records deleted.
511
509
0 commit comments