5 ms·
What I like is a system where you first create a plan for what you will do, then there is an executor that will execute the plan. So --dry-run just doesn't run
by IgorPartola 5y ago
What I like is a system where you first create a plan for what you will do, then there is an executor that will execute the plan. So --dry-run just doesn't run the executor. Of course, depending on what you are working with that might not be possible, but if you can design it like so, do it. It also makes everything nicely decoupled.
- cortesoft 5y agoYeah, not sure how this would work with any workflow that caLLs out to another service and uses the result of that to determine the next step, if that intermediate call changes state somewhere.
- dundarious 5y agoThen you can only really dry run that first phase anyway.
- minitoar 5y agoIndeed, the other service then needs to support dry runs.
- ItsMonkk 5y agoI think a large part of the next 10 years is us figuring out that frameworks are an anti-pattern and that everything is going to have to move to libraries that abide by CQRS.
- rocqua 5y agoDid not know what CQRS is, did some light googling[1]: CQRS (Command and Query Responsibility Segregation) is an alternative to a simple CRUD-based database interface. CQRS separates reads and writes into different models, using commands to update data, and queries to read data. Commands should be task-based, rather than data centric. ("Book hotel room", not "set ReservationStatus to Reserved"). Commands may be placed on a queue for asynchronous processing, rather than being processed synchronously. Queries never modify the database. A query returns a DTO that does not encapsulate any domain knowledge. The models can then be isolated, as shown in the following diagram, although that's not an absolute requirement. [1]
- faizshah 5y agoI really like this book on CQRS & ES: https://www.amazon.com/Practical-Microservices-Event-Driven-Architectures-Sourcing-ebook/dp/B0899K5R4P https://www.amazon.com/Practical-Microservices-Event-Driven-... It’s a really practical treatment of CQRS & ES with JS examples. I had heard about CQRS & ES on HN for years but I had never seen any system that actually used it or any practical examples so this book is amazing cause it takes you through how to build a system using them.
- bcbrown 5y agoAre you worried about that intermediate call changing between the dry run and the actual run? That can be avoided by saving the execution plan and allowing the actual run to load the execution plan from the dry run.
- klodolph 5y agoYes, I like this a lot. You often end up with a main code path that looks like this: do a bunch of stuff make a plan if dryRun { plan.Print() exit() } plan.Execute()
- toxik 5y agoLines 1 & 3 had side effects, sad panda
- klodolph 5y agoReading from disk, spending CPU cycles, allocating memory, and making queries on the network are all technically side effects--but they're not really cause for "sad panda". Everything on a computer has some side effects, and the purpose of --dry-run is to stop execution without certain effects that we care about. It's impossible to eliminate side effects entirely, so this is not a goal.
- numpad0 5y agoI had http:// http:// 192.168.100.123 :7654/lights_on.sh that idempotentially turns on lights in my room. Trying to query or even pre-fetching does it. I was aware it’s not wisest, wasn’t as stupid as to expose it, also it broke so it is no more, but there’s always the guy who does that.
- howinteresting 5y agoHTTP PUT is for idempotent operations, and would be appropriate here.
- deleted 5y ago[deleted]
- mmerlin 5y agoHTTP GET is also idempotent in REST, and slightly easier than PUT (since you can just append any parameters onto the end of the URL with GET instead of inserting them into the HTTP headers with PUT)
- renewiltord 5y agoI'm sure there have been older tools with this, but Terraform is the first I encountered with it and I really like this model.
- ficklepickle 5y agorsync is where I first encountered it. I've made it a habit to always do a dry run first as a sanity check and it has saved me some headaches.
- renewiltord 5y agorsync has a plan mode? I had no idea.
- joh6nn 5y ago-n or --dry-run. Rsync has a TON of features, it is worth the time to thoroughly read the man page at least once
- renewiltord 5y agoRight, but `--dry-run` is just a dry run mode, right? You have to sort of post-process it to create a plan. I feel like the context for this comment thread was lost. Just to repeat it to forestall any further discussion in this subthread on non-plan dry-run, this is how I saw it: * Igor: a good way to do dry run is to make plan * * Me: first time i have seen 'plan' as explicit step for dry-run is with Terraform * * * fickle: rsync is where i first encounter it [it here is not plan, it is dry-run] * * * * me: really? rsync has 'plan'? * * * * * john: rsync has dry-run. read manpage i.e. Igor and I are talking about explicit plan (which is interesting model) and you guys are talking about dry-run.
- joh6nn 5y agoAh, sorry, I definitely lost that context. Thanks for clarifying