@@ -4,21 +4,20 @@ pgpro_scheduler allows to schedule jobs execution and control their activity
44in PostgreSQL database.
55
66The 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.
109
1110Each job could calculate its next start time. The set of SQL commands
1211could be executed in the same transaction or each command could be executed in
13- individualtransaction . It's possible to set SQLcommand to be executed on
12+ individualone . It's possible to set SQLstatement to be executed on
1413failure of main job transaction.
1514
1615##Installation
1716
18- pgpro_scheduler is a regular PostgreSQL extension andrequire no prerequisites.
17+ pgpro_scheduler is a regular PostgreSQL extension andrequires no prerequisites.
1918
20- Before build extension from source make sure that theevironment variable
21- PATH includes path to` pg_config ` utility. Also make sure that you have
19+ Before build extension fromthe source make sure that theenvironment variable
20+ ` PATH ` includes path to` pg_config ` utility. Also make sure that you have
2221developer version of PostgreSQL installed or PostgrteSQL was built from
2322source code.
2423
@@ -27,7 +26,7 @@ Install extension as follows:
2726$ cd pgpro_scheduler
2827$ make USE_PGXS=1
2928$ sudo make USE_PGXS=1 install
30- $ psql <DBNAME> -c "CREATEEXTNESION pgpro_scheduler"
29+ $ psql <DBNAME> -c "CREATEEXTENSION pgpro_scheduler"
3130
3231##Configuration
3332
@@ -42,21 +41,21 @@ help to handle scheduler configuration.
4241* ** schedule.scheme** - text, the` scheme ` name where scheduler store its
4342tables and functions. To change this value restart required. Normally
4443you 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
4645foreign data wrapper on master system to wrap default scheduler schema
4746to another and use it on replica. Default value: schedule.
4847* ** schedule.nodename** - text, node name of this instance.
4948Default value is `master`. You should not change or use it if you run
50- single server configuration. But it isneccessary to change this name
49+ single server configuration. But it isnecessary to change this name
5150if you run scheduler on hot-standby database.
5251* ** schedule.max_workers** - integer, max number of simultaneously running
5352jobs for one database. Default value: 2.
5453* ** schedule.transaction_state** - text, this is internal variable.
5554This variable contains state of executed job. This variable was designed
56- to use with a next job start timecalculationi procedure.
55+ to use with a next job start timecalculation procedure.
5756Possible values are:
58- ***success** - transaction finished successfully
59- ***failure** - transaction failed to finish
57+ ***success** - transactionhas finished successfully
58+ ***failure** - transactionhas failed to finish
6059***running** - transaction is in progress
6160***undefined** - transaction has not started yet
6261
@@ -68,7 +67,7 @@ help to handle scheduler configuration.
6867You could manage scheduler work by means of PostgreSQL variables described
6968above.
7069
71- For example, you have a fresh PostgreSQL installation withsheduler extension
70+ For example, you have a fresh PostgreSQL installation withscheduler extension
7271installed. You are going to use scheduler with databases called 'database1' and
7372'database2'. You want 'database1' be capable to run 5 jobs in parallel and
7473'database2' - 3.
@@ -107,7 +106,7 @@ where:
107106
108107* ** N<sub >min</sub >** - the minimal acceptable amount of bgworkers in the
109108system. Consider the fact that other systems need to start background
110- workers too. E.g. parallel queries. So you need toajust the value to
109+ workers too. E.g. parallel queries. So you need toadjust the value to
111110their needs either.
112111* ** N<sub >databases</sub >** - the number of databases scheduler works with
113112* ** MAX_WORKERS<sub >n</sub >** - the value of` schedule.max_workers `
@@ -217,7 +216,7 @@ Creates job and sets it active.
217216
218217Arguments:
219218
220- * ** date** -exect date of execution
219+ * ** date** -exact date of execution
221220* ** sql** - SQL statement to execute
222221* ** node** - node name, optional
223222
@@ -229,7 +228,7 @@ Creates job and sets it active.
229228
230229Arguments:
231230
232- * ** date** -exect date of execution
231+ * ** date** -exec date of execution
233232* ** sqls** - set of SQL statements to be executed
234233* ** node** - node name, optional
235234
@@ -265,7 +264,7 @@ Creates job and sets it active.
265264
266265The only argument is a JSONB object with information about job.
267266
268- The objectcoubl contains the following keys, some of them could be omitted:
267+ The objectcould contains the following keys, some of them could be omitted:
269268
270269* ** name** - job name;
271270* ** node** - node name;
@@ -275,25 +274,25 @@ The object coubl contains the following keys, some of them could be omitted:
275274* ** command** - SQL statement to be executed;
276275* ** commands** - a set of SQL statements to be executed as an array;
277276* ** run\_ as** - user to execute command(s);
278- * ** start\_ date** - begin of period while commandcould be executed,
277+ * ** start\_ date** - begin of period while commandcan be executed,
279278could be NULL;
280- * ** end\_ date** - end of period while commandcould be executed,
279+ * ** end\_ date** - end of period while commandcan be executed,
281280could be NULL;
282281* ** date** - exact date when command will be executed;
283282* ** dates** - set of exact dates when command will be executed;
284283* ** use\_ same\_ transaction** - if set of commands will be executed within
285284the same transaction. Default: false;
286- * ** last\_ start\_ available** - for how longcould command execution could be
285+ * ** last\_ start\_ available** - for how long command execution could be
287286postponed if maximum number of allowed workers reached at the scheduled
288287moment. 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 setwill
290- wait forever. Default: NULL;
291- * ** max\_ run\_ time** - for how long scheduled jobcould 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 jobcan be executed.
292291Format: `interval`. If NULL or not set - there is no time limits.
293292Default: NULL;
294293* ** onrollback** - SQL statement to be executed on ROLLBACK if main
295294transaction failure. Default: not defined;
296- * ** next\_ time\_ statement** - SQL statement tocaclulate next start time.
295+ * ** next\_ time\_ statement** - SQL statement tocalculate next start time.
297296
298297The rules of scheduling could be set as cron-like string (key` cron ` ) and
299298also as JSONB object (key` rule ` ).
@@ -311,21 +310,21 @@ This object contains the following keys:
311310Also job could be scheduled on exact date or set of dates. Use keys` date `
312311and` dates ` keys accordingly.
313312
314- All schedulingmwthods could be combined but the use at least one of them is
313+ All schedulingmethods could be combined but the use of at least one of them is
315314mandatory.
316315
317- Key` next_time_statement ` should contains SQLstatment to be executed
318- after the main transaction to calculatenet start time. If key is defined
316+ Key` next_time_statement ` may contain SQLstatement to be executed
317+ after the main transaction to calculatenext start time. If key is defined
319318the first start time will be calculated by methods described above but
320319successive start times will be derived from this statement. The statement
321320must return record with the first field containing value of type
322321` timestamp with time zone ` . If returning value be of the different type or
323- statementexection produce an error the job will be marked as broken and further
322+ statementexecution produce an error the job will be marked as broken and further
324323execution will be prohibited.
325324
326- Thisstatment will be executed in spite of main transaction execution state.
325+ Thisstatement will be executed in spite of main transaction execution state.
327326It's possible to get state of main transaction form postgres variable
328- schedule.transaction_state`.
327+ ` schedule.transaction_state ` .
329328
330329The possible values are:
331330
@@ -338,11 +337,11 @@ The last two values should not appear as a value of the key
338337` next_time_statement ` within user procedure.
339338
340339SQL statement to be executed could be set in` command ` or` commands ` key.
341- The first oneset the single statement, the second the set of statements.
340+ The first onesets the single statement, the second - the set of statements.
342341In fact the first key could contains the set of commands in one string
343342divided by semicolon. In this case they all be executed in single transaction
344343in spite of the value` use_same_transaction ` . So for set of the statements
345- is better to use key` commands ` key as you get morecontroll on execution.
344+ is better to use key` commands ` key as you get morecontrol on execution.
346345
347346Returns id of created job.
348347
@@ -375,7 +374,7 @@ Arguments:
375374* ** value** - property value
376375
377376The 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
379378be passed as an array, but if the value could not be an array the exception
380379will be raised.
381380
@@ -416,7 +415,7 @@ Returns true on success, false on failure.
416415
417416###schedule.get_job(job_id integer)
418417
419- Retrieves information about the job
418+ Retrieves information about the job.
420419
421420Arguments:
422421
@@ -434,12 +433,12 @@ Arguments:
434433* ** username** - user name, optional
435434
436435Returns the set of records of type` cron_rec ` . Records contain information
437- about jobs owned by user. If user name isnot specified session user is
436+ about jobs owned by user. If user name isomitted the session user name is
438437used.
439438
440- Retrive jobs owned by another user is allowed only to superuser.
439+ Retrieve jobs owned by another user is allowed only to superuser.
441440
442- Type ` cron_rec ` description can be found in** SQL type** section.
441+ ` cron_rec ` type description can be found in** SQL type** section.
443442
444443###schedule.get_user_cron(username text)
445444
@@ -453,7 +452,7 @@ Returns the set of records of type `cron_rec`. Records contain information
453452about jobs executed as user. If user name is not specified session user is
454453used.
455454
456- Retrive jobs executed as another user is allowed only to superuser.
455+ Retrieve jobs executed as another user is allowed only to superuser.
457456
458457Type` cron_rec ` description can be found in** SQL type** section.
459458
@@ -465,47 +464,46 @@ Arguments:
465464
466465* ** username** - user name, optional
467466
468- If user namenot specified the session user name used. To list jobs executed
467+ If user nameis omitted the session user name used. To list jobs executed
469468as another user allowed only to superuser.
470469
471470Return value is set of records of type` cron_job ` .
472- See type description in** SQL types** section.
471+ Seethe type description in** SQL types** section.
473472
474473###schedule.get_active_jobs()
475474
476- Функция возвращает список всех задач, которые исполняются в данный момент .
477- Может быть выполнена только пользователем с правами суперпользователя .
475+ Returns list of jobs being executed at that very moment .
476+ The function call allowed only to superuser .
478477
479- Задачи возвращаются в виде набора записей типа ` cron_job ` . Описание типа вы
480- можете найти в разделе ** SQLтипы ** .
478+ Return value is set of records of type ` cron_job ` .
479+ See the type description in ** SQLtypes ** section .
481480
482481###schedule.get_log()
483482
484- Функция возвращает список всех выполненых задач.
485- Может быть выполнена только пользователем с правами суперпользователя .
483+ Returns list of all completed jobs.
484+ The function call allowed only to superuser .
486485
487- Задачи возвращаются в виде набора записей типа ` cron_job ` . Описание типа вы
488- можете найти в разделе ** SQLтипы ** .
486+ Return value is set of records of type ` cron_job ` .
487+ See the type description in ** SQLtypes ** section .
489488
490489###schedule.get_user_log(username text)
491490
492- Функция возвращает список всех выполненых задач, которые выполнялись с правами
493- пользователя, переданного в аргументах.
491+ Returns list of completed jobs executed as user passed in arguments.
494492
495493Arguments:
496494
497- * ** username** -имя пользователя, опционально
495+ * ** username** -user name, optional
498496
499- Если не указано имя пользователя, то используется имя пользователя сессии .
500- Чужие задачи может просматривать только суперпользователь .
497+ If username is omitted the session user name used .
498+ Jobs executed as another users are accessible only to superuser .
501499
502- Задачи возвращаются в виде набора записей типа ` cron_job ` . Описание типа вы
503- можете найти в разделе ** SQLтипы ** .
500+ Return value is set of records of type ` cron_job ` .
501+ See the type description in ** SQLtypes ** section .
504502
505503###schedule.clean_log()
506504
507- Удаляет все записи о выполненных задачах. Может быть выполнена только с правами
508- суперпользователя .
505+ Delete all records with information about completed jobs.
506+ Can be called by superuser only .
509507
510- Возвращает количество удаленных записей
508+ Returns the number of records deleted.
511509