I blogged about getting started with Hamilton for ...
# general
c
I blogged about getting started with Hamilton for a simple workflow. If I misrepresented anything, let me know and I'll try to fix it. Thanks. https://pyright.blogspot.com/2024/07/dag-hamilton-workflow-for-toy-text.html
🙌 1
❤️ 1
e
This is really cool! Nice work! Very cleanly written — I really like this description of Hamilton:
Copy code
Hamilton uses a system whereby you name your functions in a noun-like fashion ("def stuff()" instead of "def getstuff()") and feed those names as variables to the other functions in the workflow as parameters. This is what allows the tool to check your workflow for inconsistencies (types, for instance) and build the graphviz chart shown above.
Appreciate this quite a bit — I imagine its OK to share out?
s
This is great. Thanks @Carl Trachte! One correction please 🙂 > DAG Hamilton had a booth on the expo floor DAGWorks is the company name. Hamilton is one of our open source projects. So I’d say something like “I discovered Hamilton by DAGWorks on the expo floor” Otherwise you might like taking a look at our lifecycle API (e.g. implement something similar to this)— you could create a deepcopy adapter that would remove the need for you to have
copy.deepcopy(...)
and push that into the framework. For example it could deepcopy a dictionary before passing it to any function.
otherwise TIL, I didn’t know you could use
print
to write to a file 🙂
c
Stefan, thanks for the tip on the lifecycle API and the deepcopy adapter. I'm at a disadvantage without access to github on my primary computer. When I can access the site on my home computer, I will try to study it and come up with a better solution. The blog is always a means to learn and a work in progress. My posts usually feature a progression from ignorance to partial enlightenment. If I can implement that, I'll post again if that's OK.
s
Carl, it's a great post.
I was just mentioning things that you might be interested in looking at later. :)
e
Yeah, the post is amazing and a great solution! Absolutely shines through. We have multiple ways to do things in Hamilton (with their own) trade-offs, and generally enjoy telling people about them 🙂
c
Thank you, Stefan. Thank you, Elijah.
🙏 2
e
Idea — if we copied the contents to our Substack, made you the author (if you have/are ok getting a Substack), and shared it out would that be ok? We would link back to your blog as the first sentence (this was originally written by Carl at py right, follow for more interesting content). No worries if not — we’ve just started doing guest blog posts and might be a nice way to share out the lessons from yours!
c
I found Elijah's January blog post on the lifecycle API. This is helpful in getting me up to speed, but I'm not there yet. https://blog.dagworks.io/p/customizing-hamiltons-execution-with There's a 404 error on the link to the Graph Adapter. I will eventually get more into the github repository on my home computer. I suspect there are some adapter examples there that I can study, copy, and smith to my own needs. Thanks for the work you are doing.
Sorry, we were composing entries at the same time, Elijah. One moment . . .
🍻 1
e
Fixed the link!
c
Merci!
🫡 1
OK, I read the intro to substack, Elijah. That sounds fine. It sounds like I don't need to actually sign up for substack, but, rather, as you indicated, send you the contents of the blog. Google's blogger is kind of awful (my impression). So my presentation isn't great and I've been too lazy to do the work of editing the raw html to make it better. What is the easiest way to get the blog contents to you (there's a couple images in there that I uploaded via blogger's user interface)? Thanks for your patience. If I'm doing things to make this harder than it is, let me know and I'll try to fix them.
e
Yeah — I can copy it from the page — no worries. And if you’re OK signing up we can make you the author!
c
OK, I'll try to sign up. Thanks, Elijah.
🙌 1