Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement autonomous tasks #122

Closed
pashagolub opened this issue Apr 16, 2020 · 2 comments
Closed

Implement autonomous tasks #122

pashagolub opened this issue Apr 16, 2020 · 2 comments
Assignees
Labels
🚀 enhancement New feature or request

Comments

@pashagolub
Copy link
Collaborator

https://twitter.com/dsl4life/status/1250382007298899969

The idea is to mark some tasks as autonomous and execute them outside of the chain transaction scope.

Thanks @a-mckinley.

@pashagolub pashagolub added the 🚀 enhancement New feature or request label Apr 16, 2020
@pashagolub pashagolub self-assigned this Apr 16, 2020
@a-mckinley
Copy link

a-mckinley commented Apr 16, 2020

Thanks for looking at this @pashagolub!

In the interim I went with a psql shell task to call the stored proc launched from by a 'SHELL::task_type which is working well, but it would be very useful to enable the SQL equivalent.

@pashagolub
Copy link
Collaborator Author

Please, try 118_context_support branch

$> pg_timetable -c worker01 -d timetable --upgrade
[2020-04-16 18:55:50.472 | worker01 | LOG   ]: Connection established...
[2020-04-16 18:55:50.516 | worker01 | LOG   ]: Proceeding as 'worker01' with client PID 6636
[2020-04-16 18:55:50.519 | worker01 | LOG   ]: Executing script: DDL
[2020-04-16 18:55:50.630 | worker01 | LOG   ]: Schema file executed: DDL
[2020-04-16 18:55:50.635 | worker01 | LOG   ]: Executing script: JSON Schema
[2020-04-16 18:55:50.638 | worker01 | LOG   ]: Schema file executed: JSON Schema
[2020-04-16 18:55:50.639 | worker01 | LOG   ]: Executing script: Built-in Tasks
[2020-04-16 18:55:50.651 | worker01 | LOG   ]: Schema file executed: Built-in Tasks
[2020-04-16 18:55:50.654 | worker01 | LOG   ]: Executing script: Job Functions
[2020-04-16 18:55:50.657 | worker01 | LOG   ]: Schema file executed: Job Functions
[2020-04-16 18:55:50.658 | worker01 | LOG   ]: Configuration schema created...
[2020-04-16 18:55:50.660 | worker01 | LOG   ]: Upgrading database...
[2020-04-16 18:55:50.667 | worker01 | USER  ]: Severity: NOTICE; Message: relation "migrations" already exists, skipping
[2020-04-16 18:55:50.705 | worker01 | LOG   ]: Checking for @reboot task chains...
[2020-04-16 18:55:50.717 | worker01 | LOG   ]: Number of chains to be executed: 0
[2020-04-16 18:55:50.719 | worker01 | LOG   ]: Checking for task chains...
[2020-04-16 18:55:50.721 | worker01 | LOG   ]: Number of chains to be executed: 0
[2020-04-16 18:55:50.722 | worker01 | LOG   ]: Checking for interval task chains...
[2020-04-16 18:55:50.724 | worker01 | LOG   ]: Number of active interval chains: 0
[2020-04-16 18:55:51.912 | worker01 | LOG   ]: Closing session

$> psql -U scheduler -d timetable -c "\i samples/autonomous.sql"
CREATE FUNCTION
CREATE FUNCTION
CREATE PROCEDURE
 chain_execution_config |      run_at
------------------------+-------------------
                      1 | @every 10 seconds
(1 row)


INSERT 0 1
$> pg_timetable -c worker01 -d timetable
[2020-04-16 18:55:55.849 | worker01 | LOG   ]: Connection established...
[2020-04-16 18:55:55.894 | worker01 | LOG   ]: Proceeding as 'worker01' with client PID 2892
[2020-04-16 18:55:56.065 | worker01 | LOG   ]: Checking for @reboot task chains...
[2020-04-16 18:55:56.067 | worker01 | LOG   ]: Number of chains to be executed: 0
[2020-04-16 18:55:56.076 | worker01 | LOG   ]: Checking for task chains...
[2020-04-16 18:55:56.083 | worker01 | LOG   ]: Number of chains to be executed: 0
[2020-04-16 18:55:56.084 | worker01 | LOG   ]: Checking for interval task chains...
[2020-04-16 18:55:56.086 | worker01 | LOG   ]: Number of active interval chains: 1
[2020-04-16 18:55:56.089 | worker01 | LOG   ]: Starting chain ID: 1; configuration ID: 1
[2020-04-16 18:55:56.103 | worker01 | USER  ]: Severity: NOTICE; Message: hi
[2020-04-16 18:55:56.248 | worker01 | USER  ]: Severity: NOTICE; Message: hi2
[2020-04-16 18:55:56.252 | worker01 | LOG   ]: Executed successfully chain ID: 1; configuration ID: 1
[2020-04-16 18:55:59.267 | worker01 | LOG   ]: Closing session

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants