DBTrenches / tsqlscheduler

MIT License
4 stars 1 forks source link

Multi-step job support #12

Open petervandivier opened 2 years ago

petervandivier commented 2 years ago

Classic UI-managed SQL Agent jobs often have multiple steps. Indeed the interface provides a wealth of options for multi-step functionality.

Presently as of v2.0, the tsqlScheduler solution supports only a single jobstep. The typical developer workaround for this seems to be to either

  1. add a series of proc executions in the one available jobstep
  2. wrap multiple procs in a single proc to be called by the jobstep

Error handling and control flow may or may not complicate these implementations. Both of them however impede debugging when things go wrong. Native support for multiple jobsteps lends itself to quicker bug identification than at present.

taddison commented 2 years ago

This will add significant complexity, and I think the answer to 'how do I do multi-step jobs with AGs' could be...use the recent solution from Microsoft. For developers there are other alternatives to schedule jobs on SQL Server with far better control/logging planes, and so this complexity is probably limited to SQL Developers/DBAs who should be capable of handling the nuance of writing those jobs in T-SQL steps?

Most jobs I've seen like this require the steps to run in order, and so testing them is far easier when there's a wrapper proc. If this glue is pushed to the scheduling layer anyone that creates a lot of additional friction for most users (who want to 'take this proc and run it every X').

Could the problem you've described for debugging be better solved with good templates for multi-step executions (and the training to go with it?).

petervandivier commented 2 years ago

...use the recent solution from Microsoft

the wat now? O_O

plz link me

taddison commented 2 years ago

I think you originally shared the link with me! Their solution to agent jobs in an AG by syncing the jobs between nodes based on the msdb schéma copies to an AG database (ish).