Latest / Talk Python To Me / #330: Apache Airflow Open-Source Workflow with Python
Transcript
- 0:00If you're working with data pipelines, you definitely need to give Apache Airflow a look.
- 0:03This pure Python workflow framework is one of the most popular and capable out there.
- 0:08You create your workflows by writing Python code using clever language operators,
- 0:12and then you can monitor them and even debug them visually once you get them started.
- 0:16So stop writing manual code or Cronjaw-based code to create data pipelines and check out Airflow.
- 0:21And to do that, we have three great guests from the Airflow community.
- 0:25Jarek Potik, Taxil Naik, and Leah Cole.
- 0:28This is Talk Python To Me, episode 330, recorded August 5th, 2021.
- 0:33Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 0:53This is your host, Michael Kennedy.
- 0:55Follow me on Twitter where I'm @mkennedy.
- 0:57And keep up with the show and listen to past episodes at talkpython.fm.
- 1:01And follow the show on Twitter via at Talk Python.
- 1:04This episode is brought to you by us over at Talk Python Training.
- 1:08And the transcripts are brought to you by Assembly AI.
- 1:11Leah, Jarek, Axel, welcome to Talk Python To Me.
- 1:16It's good to have you all here.
- 1:16Thanks for having us.
- 1:17Thank you.
- 1:18Yeah.
- 1:18It's really fun to be talking about Airflow.
- 1:20These are the types of tools that I think they don't get that much awareness, but they're the kind of thing that can be the real backbone of a lot of teams, a lot of organizations, and so on.
- 1:31So I think that'll be super fun to dive into.
- 1:34And we'll all learn a lot.
- 1:35And I suspect a lot of people listening will realize, oh, here's a whole class of tools.
- 1:39I didn't even realize I should have considered to solve my problems.
- 1:42But before we get down to that, let's start with your stories.
- 1:45Leah, you go first.
- 1:46How do you get into programming Python?
- 1:47Python was the first language that I learned.
- 1:51I do have a bachelor's in computer science.
- 1:54And the school I went to, that is the language that Intro to CS is taught in.
- 2:00I am so jealous.
- 2:01My Intro to CS class was in Scheme, which is derivative of Lisp, which didn't seem that practical.
- 2:07And then I was told I had to learn Fortran.
- 2:09It would be the most useful language I'd ever learn.
- 2:11Neither of which turned out to be true.
- 2:13I wish I learned Python.
- 2:14So thanks, Carlton College, Northfield, Minnesota, for giving me Python early.
- 2:19And yes, I loved Python from the beginning.
- 2:22You asked how I got into programming.
- 2:24So I actually do have a parent in tech.
- 2:26It is my dad.
- 2:28And he tried to get me into programming a lot earlier.
- 2:30And like a true teen, I said, absolutely not.
- 2:34Because it was suggested by my dad.
- 2:36It really wasn't until I got to school.
- 2:39And I heard people say that Intro to CS was a fun elective.
- 2:43For those only listening, that's totally in quotes, as I'm saying it, that I decided to take it.
- 2:49And it turned out I really liked it.
- 2:51And I decided to pivot from being a math major, which wasn't going very well, to being a computer science major.
- 2:57Yeah, that's fantastic.
- 2:58I was also a math major.
- 2:59And I find the programming side, a lot of the same skill set you have to use.
- 3:04Like the thinking through problem solving.
- 3:06You have these constraints or axioms in math.
- 3:09And you work from them.
- 3:11But in math, you just come up with sort of like the next idea that is the next problem that is the next idea.
- 3:16And in computers, you build stuff that people use.
- 3:19Exactly.
- 3:19And it's such a difference, I find.
- 3:21It's puzzles is the programming.
- 3:23And that was always the part of math that I liked.
- 3:25I never liked the writing proofs or the theoretical side of things.
- 3:30I just wanted to solve puzzles with logic and rules.
- 3:33Yeah, fantastic.
- 3:34Well, it sounds like you've landed in the right spot.
- 3:36That's awesome.
- 3:36I'm doing okay.
- 3:37Jarek, how about you?
- 3:39Yes, you talked about your first language.
- 3:41So my first language in computer science during the studies was, I think, Delphi or Pascal.
- 3:48I can't even remember that.
- 3:50But actually, the first language I started programming in the real work was, listen to that, Kobol.
- 3:56So I tend to joke that when I'm retiring, I will be very well paid five hours a week programmer of Kobol.
- 4:07Because nobody else will know it.
- 4:09You're going to keep the trucks delivering and the warehouses open.
- 4:12Exactly.
- 4:13Beautiful.
- 4:14Just five hours a week.
- 4:17Yeah, that's super cool job, I think.
- 4:20But then Python is actually quite new in my portfolio, let's say, of languages.
- 4:24I've learned it maybe six years ago.
- 4:27And with my experience and years of working in CS, it's relatively late.
- 4:33But I loved it from the first glance.
- 4:35I used to work in like C, Java, C++, hundreds of other, a lot of other languages.
- 4:41But Python was just super easy from the start and super nice tool and super, super friendly.
- 4:47Like, I was, after years of programming in Java, I was like so much, oh, one line you can do what I would do in five pages of Java code.
- 4:57Yeah.
- 4:57Yeah.
- 4:58That's cool.
- 4:58And you can understand it as well.
- 5:00Yes.
- 5:00Yes.
- 5:02So, yeah.
- 5:03So, yeah.
- 5:03I fell in love immediately.
- 5:04And this is my absolutely favorite language right now.
- 5:08Same here.
- 5:09Axel?
- 5:09Yeah.
- 5:10For me, I did my bachelor's in electrical engineering.
- 5:13So, didn't do anything over there.
- 5:15But when I came in the UK to do my master's, we were taught R language and Java.
- 5:21One fine day, we were ending the college in just a month or two.
- 5:26And there was a presentation from someone in the university who was telling us how to use data science in the industry and everything.
- 5:32They said, you should know Python.
- 5:34And you're like, oh, but we were not taught Python.
- 5:37And we are just one or two months away from doing our internships and everything.
- 5:41And we don't know Python.
- 5:42So, that's when I started looking into Python.
- 5:45I got an internship.
- 5:47And then I actually started learning more of Python.
- 5:50So, this was 2016, I'm talking about.
- 5:53And, yeah, since then it has been a wild, wild ride.
- 5:56I have written a lot of Java, a lot of R.
- 5:58But Python seems to be very easy to write, easy to understand.
- 6:03Plus, the community behind it and the packages behind it are so vast that you can use it for anything.
- 6:09And basically, yeah.
- 6:10I saw a funny t-shirt once that said, I learned Python.
- 6:13It was a great weekend.
- 6:13Which I think is really funny, right?
- 6:16Because on one hand, yeah, sure, you can go through.
- 6:20And actually, the language is simple, especially if you know something else that's like Java or C++.
- 6:24Oh, this is a breath of fresh air, right?
- 6:26But on the other hand, I've been doing this for a long time, all day, every day.
- 6:30And I'm still learning Python every day, right?
- 6:32So, it's a really interesting juxtaposition of, like, you can learn the language really easily.
- 6:36But then there's the standard library.
- 6:38And then there's 300,000 PyPI packages.
- 6:40Like, Airflow is just one of them.
- 6:42And that's our whole topic today, right?
- 6:44So, it's kind of both, right?
- 6:45Yeah.
- 6:45And the language keeps growing.
- 6:47So, you've got to keep track of the cool new things that are released.
- 6:50And things that are true in Python 2.7 are definitely not true today with Python 3.10.
- 6:57It's grown a lot.
- 6:58It definitely has.
- 7:00And I saw that Airflow is not supporting the older versions of Python, basically, as they get deprecated.
- 7:05So, yay for that, right?
- 7:06Yeah, we have actually, you know, very, very strong rules following the Python release rules.
- 7:12So, we've learned from what Python learned on the release schedule.
- 7:16And we just follow it very, very closely with, like, how much we have when we support, when we stop, we support Python.
- 7:22That makes a lot of sense.
- 7:23Yeah, it's difficult to maintain compatibility between Python 2 and 3.
- 7:27That's a lot of overhead.
- 7:28Actually, we, yes.
- 7:30I have nightmares about it, cherry picking all the stuff from the main branch to the old release branch and adding Python to support.
- 7:37But Kaxil, you cannot complain.
- 7:39I mean, we both, but Kaxil did that a lot.
- 7:41And thanks to that, we've been several times top committers on Apache organization.
- 7:48Like, there is a, like, this week, most commits made.
- 7:51And that was us doing cherry picks between three version and two seven version.
- 7:56And once, we made it both at the same time, top committers on Apache.
- 8:01Fantastic.
- 8:02I'm mad at GitHub.
- 8:03The GitHub does not count commits on any other branch except main or master.
- 8:07Oh, not fair, not fair.
- 8:10We'll have to do our own visualizations.
- 8:13Exactly.
- 8:14Yeah, exactly.
- 8:15All right.
- 8:16Before we move on out of the live stream, Hawaii girl says Python is awesome, like all of us.
- 8:20Yes, definitely.
- 8:20Thanks for being here.
- 8:21All right.
- 8:22Well, let's start this at a slightly higher conversation than just Airflow.
- 8:27So Airflow is one of these workflow management frameworks.
- 8:31Whoever wants to take this, what is that?
- 8:34Why do I need that?
- 8:35When do I need that?
- 8:36What are these tools, as I hinted at the beginning?
- 8:38I want to walk through some of the history, though, like in 2014, 2015, where like data engineering
- 8:44was not mainstream and everyone was just using Cron for scheduling their task.
- 8:51And then there came Luigi, where people were using XML and those sort of languages to write
- 8:58their tags workflows to make sure that the task runs on schedule.
- 9:02Yeah.
- 9:03So DAGs directed acyclic graphs?
- 9:06Yes.
- 9:06Okay.
- 9:07Yeah.
- 9:08Let's be very clear.
- 9:09You cannot have a circle for tasks.
- 9:12The dependencies cannot be that.
- 9:15People have tried that.
- 9:16It takes a long time to finish those.
- 9:18Yes.
- 9:19A little bit.
- 9:19A long time.
- 9:20Some of those decks are still running.
- 9:22So it takes a long time for them to start sometimes, too.
- 9:27But yeah, I think to complete the history part, people just got bored writing the XML syntax.
- 9:34And it's difficult to understand.
- 9:36Similar to what we were talking about, Java and Python.
- 9:39Like Python is much easier to read, easier to understand.
- 9:42There came Airflow.
- 9:44Maxime wrote Airflow in his time at Airbnb and open sourced it to Apache Software Foundation.
- 9:50And that had a sigh of relief for people working on Luigi and others as well.
- 9:55Because then you could write your workflows in an easy to understand language that you're already very familiar with.
- 10:01You don't need to write those XMLs.
- 10:04And who loves writing XMLs, first of all?
- 10:09And so it's easy to understand.
- 10:11Just configuration as code.
- 10:13And there was also, I think, a slight move towards everything as code.
- 10:18Infrastructure as code with Terraform and Ansible and whatnot.
- 10:22And Airflow was just a perfect tool for workflow as code or DAGs as code.
- 10:28And since, I think, 2016 to 2018, Airflow's popularity has skyrocketed with the advent of, like, separate specialized data engineering field.
- 10:38Previously, I think software engineers used to do everything.
- 10:41But then people or companies also realized that it's a separate field.
- 10:45It's a lot of work.
- 10:46It's not, you can also just not include machine learning engineer and let him do everything.
- 10:51It's a separate data engineer's job to write a pipeline, knows how to handle the data, and everything from start to start.
- 10:59Let's realize that thousands of things, which, first of all, your Cron expressions or Cron alone cannot handle those.
- 11:05The task dependencies, the SLAs and whatnot.
- 11:09So I think that's when, with the advent of data engineering, people realizing the importance of data, Airflow's popularity gained massively between 2080,
- 11:19which also, by the way, coincided with where Airflow became the top-level project in Apache Software Foundation.
- 11:25Until then, Airflow was just an incubating project in ASF.
- 11:29And then it became a top-level project.
- 11:32And that was a big milestone for Airflow and the community.
- 11:35I think data engineering is really interesting because a lot of people, when they think of,
- 11:39well, what are the divisions of what you do with programming, you know, especially in Python?
- 11:43Well, we've got, like, web programming, to some degree, UI programming,
- 11:47and then we've got data science.
- 11:49Sort of web and data science are the two, but there's this middle ground where I feel like
- 11:54people kind of don't want to go there, or that's the data, right?
- 11:57You want to make sure if you get a bunch of data and you feed it to your model,
- 12:00your model is only as good as the data you get, right?
- 12:03If you're trying to automate some ingest of data or warehousing reporting,
- 12:08it's only as good as the reliability of the data coming in, the accuracy, right?
- 12:13We've got things, was it great expectations and stuff like that for testing, actually testing
- 12:18against the data, not the code that works with the data.
- 12:22Yes.
- 12:22And let me just add, because also Airflow is really an orchestrator.
- 12:27So, like, I used to sing in the choir for many years.
- 12:30And for me, this is really, like, this parallel between the conductor and the team playing.
- 12:35We don't do stuff in Airflow.
- 12:37Airflow doesn't do stuff.
- 12:38It just tells others what to do.
- 12:40And there's data processing stuff.
- 12:43So, like, we don't know how, basically, we as data engineers, because, like, we are actually,
- 12:48you know, data software engineers writing things for data engineers.
- 12:52So, when we think about, like, this cross of this both, like, software engineer and data
- 12:56engineer, so we don't know how to actually make a model, machine learning model.
- 13:00Or we don't know machine learning.
- 13:02We don't know how to, even we don't know how to do MapReduce, right?
- 13:06I mean, if you want to process a lot of data, but we know what to do with the data when it
- 13:11comes, who should do next, what, and what, how to pass it somewhere else.
- 13:15And we can make it super complex to define or complex in terms of composed of many, many
- 13:22different steps in different relations.
- 13:24But Airflow makes it super easy to manage the whole thing so that it runs smoothly and you
- 13:29can operate it and you don't, and you can deal with any problems that arise on the go.
- 13:34So, Jarek, at this point, I want to expand on it real quick.
- 13:38There's a very human aspect to the workflow orchestration that I think both you, both
- 13:43Kexil and Jarek have touched on, which is that having a workflow orchestrator really enables
- 13:49you to move from having, like, the data scientist in their silo working on this pipeline alone
- 13:55to having a whole team of data scientists and data engineers working together.
- 14:00Because you have really specialized folks who can work on building those models.
- 14:04And that might not be the same group of people that's figuring out how to get the data from
- 14:08A to B and making sure that it's healthy and is what the model and the data scientists are
- 14:14expecting.
- 14:15So I think it just enables a lot more collaboration and helps you have more specialists working together.
- 14:22Yeah, it becomes that well-known, well-tested way to flow data down into the specialties that people need, right?
- 14:30Exactly.
- 14:33Talk Python To Me is partially supported by our training courses.
- 14:35At Talk Python, we run a bunch of web apps and web APIs.
- 14:39These power the training courses as well as the mobile apps on iOS and Android.
- 14:43If I had to build these from scratch again today, there's no doubt which framework I would use.
- 14:48It's FastAPI.
- 14:49To me, FastAPI is the embodiment of modern Python and modern APIs.
- 14:54You have beautiful usage of type annotations.
- 14:57You have model binding and validation with Pydantic.
- 14:59And you have first class, async, and await support.
- 15:02If you're building or rebuilding a web app, you owe it to yourself to check out our course,
- 15:06Modern APIs with FastAPI over at Talk Python Training.
- 15:10It'll take you from curious to production with FastAPI.
- 15:14To learn more and get started today, just visit talkpython.fm/FastAPI
- 15:18or email us at sales at talkpython.fm.
- 15:21One of the things you do in these types of frameworks is you build these tasks, right?
- 15:28Give us an idea of what some of the tasks look like.
- 15:31And you actually have a whole bunch of, would that be the integrations in there?
- 15:35Or is that something different?
- 15:36Provisors.
- 15:37That's the name that we are using in Airfield too.
- 15:40Yes.
- 15:40So we have like more than 70 of those right now.
- 15:43We do for 70 services we talk to, external services or databases or whatnot.
- 15:5070 entities.
- 15:52But within that, we have several hundreds of these so-called operators or sensors
- 15:58or transfer operators, which perform the task.
- 16:02And they're actually super easy.
- 16:04It's just one method.
- 16:05Execute.
- 16:06That's it.
- 16:06Right.
- 16:07That's pretty much it.
- 16:08Yeah.
- 16:08There's the three things, the sensors, the operators, the transfers.
- 16:11Like an example of a sensor might be waiting to see if an object is in S3 or in Google Cloud
- 16:18storage.
- 16:19And a transfer is moving something from A to B.
- 16:23And an operator, those are the ones we probably have the most of, right?
- 16:27Yak and Kaxel.
- 16:28And that, it can be anything in a service.
- 16:31I don't know, like starting running.
- 16:33So I work in Google Cloud, so the operators I'm most familiar with are the Google ones.
- 16:37So like spinning up a data cluster and then running a Spark job on it or running something
- 16:44on a Kubernetes pod.
- 16:45There, yeah.
- 16:46If you can dream it, either there is an operator for it or you can write an operator for it.
- 16:51Yeah.
- 16:51Yeah.
- 16:52When I started with Airflow back in 2017, we used Airflow for the same reason.
- 16:57Like Airflow was designed for being a classic ETL tool or being an enabler of sorts.
- 17:02So a lot of companies were migrating from on-premises to cloud.
- 17:06We were doing a project in partnership with Google to move customers' data to cloud.
- 17:11And we were using NiFi for data to be on GCS.
- 17:16But from there, everything was orchestrated by Airflow.
- 17:20So once the data lands in Google Cloud Storage, then there's classic ETL, that extract, transform,
- 17:26load.
- 17:26From GCS, it goes to BigQuery.
- 17:29BigQuery does some manipulations and the data goes to like, there's a dashboard, a data studio
- 17:36that shows a rich dashboard behind it.
- 17:38And this is all managed by Airflow.
- 17:41And it was so easy because we separated this using task and we were using all the hooks and
- 17:46operators that Leah and Jarek were talking about, which was like GCS to GCS operator, move
- 17:52the data from the landing area to staging.
- 17:55So your landing area remains untouched.
- 17:57So you can verify with your vendor that the data is as recent, even in futures.
- 18:03And then there were BigQuery operator to run SQL query.
- 18:07And then there are other operators for different GCS services.
- 18:11So I think with Google, there was already a good amount of integrations back three, four
- 18:16years back.
- 18:16Similarly for Spark and other operators.
- 18:19Yeah.
- 18:20One of the things that stands out to me that might be really useful here is if something
- 18:24goes wrong.
- 18:25You know, you talked about the contrast being cron jobs or something like that.
- 18:29And if something goes wrong with that, or you need to scale out across different machines
- 18:33or whatever, and how do you get those timings right or other weird things?
- 18:37So what's the mechanism for dealing with, you know, I'm going to get some data.
- 18:41It drops in the cloud.
- 18:42I'm going to pull it over.
- 18:43But then maybe it's invalid data or something.
- 18:45What's that look like?
- 18:47So at least for Airflow, all the operators that were written previously or the idea behind
- 18:53them were the task, a single operator or a single task should be idempotent.
- 18:56So even if you run them multiple times, it should produce the same result.
- 19:00So if a task for whatever reason fails, you could add more retries to it.
- 19:05There's a retry parameter that the base class takes.
- 19:08And you could say retries is four, retries is five, and Airflow will handle that for you.
- 19:13So if a task fails, it will rerun it for that amount of time.
- 19:16Right.
- 19:16It could fail because the database server is down, or it could fail because it's never going
- 19:20to work, right?
- 19:21It could be either one.
- 19:21Exactly.
- 19:22And you want to be notified as well.
- 19:24So then we had all those on failure callback, on success callback, those emails get sent out
- 19:30saying the data didn't arrive at all or whatever the reason may be.
- 19:34There is even more to that because we also have the mechanism of backfilling the data.
- 19:38So even in this case, it's not like not a server failure, but your data has improved.
- 19:43Because you've got a new metadata and you want to reprocess the data you've already processed
- 19:48for like last week or only process part of the data because it takes a lot of time.
- 19:54And you know that the data up to a certain point is good, but then you have to process just part
- 19:59of your workflow of part of your DAG for the last week.
- 20:03You can do that with Airflow.
- 20:05So you can just tell, make a command, run a command, just reprocess me that data for
- 20:10this period of time, starting from this task, because this is where we know we have to reprocess
- 20:16the data because the data has been cleaned up, for example.
- 20:18Right.
- 20:19You don't have to detect it.
- 20:20You don't have to copy it down.
- 20:21You've changed it locally and you want it to get fixed.
- 20:23I see.
- 20:24Okay.
- 20:24And the super cool thing there is that this can be done by one person who doesn't know
- 20:28what those tasks are doing at all.
- 20:30Like they are just all the language of how the tasks are written.
- 20:34The specification is written in the way that anyone can do that.
- 20:37And then this person operating can very safely just rerun parts of it and be sure that what
- 20:42comes out at the end is just what they are expecting.
- 20:45And if you have like hundreds and thousands of that's written by, you know, tens and twenties
- 20:50or hundreds of people, just one person can sit down and operate all the whole, the whole
- 20:55of it without understanding a single thing, how it works inside.
- 20:59But knowing, with seeing what happened, this is like so powerful.
- 21:03Yeah.
- 21:03Part of Earth.
- 21:04It lets you focus on just the steps and not all the bit together, right?
- 21:08So yeah, let's focus on a couple of things on the website here that I think are maybe worth
- 21:13calling out.
- 21:14One of the things here is that the project has four principles that are really nice.
- 21:21Maybe you want to highlight those for people?
- 21:22Yeah, I think.
- 21:24Okay.
- 21:24So the four principles, it's that Airflow is dynamic, extensible, elegant, and scalable.
- 21:30And I am going to go ahead and pick my favorite one right here.
- 21:34And it's one that we've kind of touched upon without spelling out clearly, which is that
- 21:38Airflow is extensible.
- 21:39Jarek talked about how we have these 70 plus providers, these various integrations with all
- 21:47kinds of services from the big cloud providers to things like Slack, Snowflake, which I know
- 21:53are also kind of big, to much smaller ones.
- 21:56And if a provider doesn't exist or if an operator doesn't exist for a task that you need to perform,
- 22:02you can write it and you can either write it and be running it in your instance of Airflow.
- 22:08Or if you're being a good steward of open source, you can write it and contribute it back to the
- 22:12community.
- 22:13So other people who need to do that task can also benefit from what you've already figured out.
- 22:19Yeah, that's really neat.
- 22:20So a lot of these would be things down here,
- 22:23like if only one person has to write,
- 22:26how do I connect to Hadoop?
- 22:28Or if you go to airflow.apache.org,
- 22:30or you go to the bottom, there's all these different--
- 22:33are these the operators, or what are these?
- 22:35Or the tasks?
- 22:36GIL DIPERSON: Those are integrations, integrations
- 22:39with the different services you have.
- 22:41So Google, for example, is a big provider,
- 22:43but it consists of integration like Google Cloud,
- 22:45CMS, data store, machine learning.
- 22:48So you have a number of integrations per provider,
- 22:51even sometimes.
- 22:52GIL DIPERSON: OK, cool.
- 22:53And Leo, if I was going to create one of these,
- 22:55if I was going to be a good citizen, I'm like, oh,
- 22:57I want to create one with AWS Lambda.
- 23:00That exists.
- 23:00But something like that, right?
- 23:01GIL DIPERSON: Yeah.
- 23:02GIL DIPERSON: Does that get contributed back to Airflow?
- 23:04So when I pip install Airflow, does that come with it?
- 23:06Or is there some external way to bring in--
- 23:09GIL DIPERSON: Yes.
- 23:10We do actually-- well, I'll have to double check with Jarek
- 23:12and Caxel, because I know we've been messing around
- 23:14with how we do the installs lately.
- 23:16So it used to be that Airflow operators
- 23:19were packaged along with Airflow.
- 23:22And when you did pip install Airflow,
- 23:24you would get everything.
- 23:25And I think that you do still get a certain number of base operators
- 23:31that are kind of like provider agnostic that come with Airflow.
- 23:34GIL DIPERSON: But the way we have things now is that all of these provider-based operator sensors,
- 23:42all these provider task things are packaged separately.
- 23:45And you add them just like you would any other kind of Python package.
- 23:48GIL DIPERSON: Right.
- 23:49GIL DIPERSON: So for example, if you want to install the Google Cloud operators, you have that separately.
- 23:53And the advantage of that is that they're released on a separate release schedule.
- 23:58GIL DIPERSON: And follow versioning that ensures they're compatible with versions of Airflow.
- 24:03And they're very clear about that.
- 24:06And it's a lot easier for Airflow users to upgrade just the providers package than it is to upgrade the entirety of Airflow,
- 24:15which for folks running in production, that is not always feasible or practical.
- 24:19GIL DIPERSON: Yeah, you can actually click on documentation link on this page, Michael.
- 24:24And then you will see all of those providers.
- 24:26So you see the list of different provider packages.
- 24:29And you can see the documentation of that versions, the different versions.
- 24:33We release them very frequently.
- 24:35Like every month, we have a bunch of providers released, which are adding new functionality.
- 24:40And they are done completely separately, as Leah said.
- 24:43Not the same release schedule as Airflow, and you can start using them faster.
- 24:48And this is actually super cool that you can actually always find something there.
- 24:54But if you don't, we don't actually force you to go this community route.
- 24:58Like those are all providers which are developed by community and maintained by the community of Apache Airflow
- 25:03under the Apache Software Foundation rules, which is called like Apache Way.
- 25:08So the way how Apache releases software.
- 25:11But if you want, you can actually build your own custom provider.
- 25:14You can build your own custom operators and you can release them separately.
- 25:18And somebody can install that.
- 25:19And they even-- we even have integration points that if people are writing the custom providers,
- 25:23they can use exactly the same feature as the community driven ones.
- 25:27And you can install them as a package, as another Python package, completely independent from Airflow.
- 25:32And it just plugs in the UI of Airflow, plugs into the whole framework, and you can start using it.
- 25:39So it's both community and custom.
- 25:41Yeah, you can go either path, right?
- 25:43That's neat.
- 25:44I think, Leah, what you're saying about the cadence, the release frequency, and maybe even the degree of seriousness with which you have to apply to these.
- 25:54You might want the main Airflow to be treated differently than some edge package or integration, right?
- 26:01Yes, definitely.
- 26:02There was a proposal for requests, the very popular HTTP library, to be integrated into Python to replace Python's HTTP layer.
- 26:14And the decision of the core devs, I believe, was we don't want to do that to request.
- 26:19To request, like it will actually make requests go much slower and only get released once a year with changes rather than, you know, as quickly as it needs to go.
- 26:28Same thing for you all, right?
- 26:29That was one of the biggest reasons for us to separate the providers, because when we were releasing 1.10.2, 1.10.3, 1.10.4, it meant that all the development was happening in the main or master branch.
- 26:41And we were not releasing from master branch because we were just releasing the minor or pet versions right now.
- 26:48And because the code has to be tested thoroughly, even if there's a small bug in one of the providers, let's say a Google GCS bucket operator or something, it has to wait until the entire code has been tested and released.
- 27:01So the cycle can be large, whereas what everyone was thinking, at least the committers and PMC members, that providers can be released more frequently, even if it means it can be released.
- 27:12If we find a bug right now, we should fix it and go with the normal ESF releasing way, which is like three days of voting and release it.
- 27:19So it is quicker release rather than waiting for the next month to club it into the core airflow release.
- 27:25Plus that way, it's easier to also check the changes that happens because imagine checking the change log for 70 odd providers, including the airflow core in a single page.
- 27:36So it will be a nightmare.
- 27:37Yeah, I bet.
- 27:38I'm just thinking of all the coordination of, well, there's some people working on the Discord integration and someone's working on the Samba integration and we're going to do a new release.
- 27:47You've got to kind of feature freeze all that stuff.
- 27:49So yeah, it makes a ton of sense to separate these things.
- 27:53Actually, this is super, super cool that, you know, I'm the release manager for providers so far.
- 27:59So I was releasing, I don't know, maybe six, seven releases over the last year.
- 28:03And actually, I do it myself in like two, three hours.
- 28:07I'm able to bring all the changes and put the release notes for all the 70 providers.
- 28:12It's all fully automated and we can manage and release that without a worry that it will break something.
- 28:17Because if one of those releases goes wrong, providers go wrong, we can simply yank this release.
- 28:22This is this fantastic feature of PyPype that you can yank the release.
- 28:26And this actually happened yesterday.
- 28:27So we discovered that the PostgreSQL we released, 2.1.0 version, had an incompatibility back with previous version of Airflow.
- 28:35We haven't discovered that during our testing.
- 28:37We test a lot of things, but this one slipped through.
- 28:40But what we've done, just yanked this release.
- 28:43Anyone can use the previous one.
- 28:44When they install Airflow and PostgreSQL operators, they will install the latest version.
- 28:49And in the meantime, we can just fix the PostgreSQL and release a new version.
- 28:53And that's super cool, actually, for maintenance release and usability and stability of your installation.
- 29:01Yeah, that's really good that you can change it around.
- 29:03All right.
- 29:04So I want to talk about, first of all, let's talk about installing.
- 29:08So how do I get Airflow onto my computer?
- 29:11It depends on if you want a hosted, managed version, like Cloud Composer, which I work on.
- 29:17Or there is one for Amazon, MWAA.
- 29:19And there's also Astronomer, which is for Caxelworks.
- 29:22Or if you want to do it yourself.
- 29:24Yes.
- 29:25In general, though, we at least say that use the constraints file.
- 29:30So every time when we release an Airflow version, we also tag in GitHub the constraints file for each of the release.
- 29:38A constraints file contains the set of known dependencies that we have tested Airflow with on the CI.
- 29:45Because Airflow has a lot of dependencies.
- 29:47And before we started using constraints, there were a lot of instances where we just released Airflow.
- 29:54And one of the dependencies released a breaking change in a minor or a patch version, which means users could install Airflow.
- 30:00And to get over it, we came up with this idea of using constraints file because Airflow is a library as well as an application.
- 30:09So for library users who want the latest versions, whereas for application, you want the stable versions of everything.
- 30:16So we came up with this balance of using the constraints file.
- 30:19So if you check that Airflow version 2.1.2, we get the Python version and then we fetch that constraints file from GitHub and use that constraint file.
- 30:29Because that way we can guarantee that it is reproducible and it will work for sure.
- 30:34Yeah, very cool.
- 30:35So if I go to the documentation, there's a couple of options.
- 30:39I can run it locally.
- 30:40I can run it in Docker.
- 30:41I can run it in Astronomer.
- 30:43But looking through the script to set things up here, it looks like there's a couple of steps.
- 30:50So there's a database that does something.
- 30:52There's some users who execute the task or, you know, you don't want to run as root most likely.
- 30:59I suspect that's something you all discourage.
- 31:01Probably.
- 31:02And there's a web server and there's a scheduler.
- 31:05So maybe tell us about that.
- 31:08Whoever wants to take it.
- 31:08Yes, I'll take it.
- 31:09So Airflow is pretty complex in setup because it has multiple components.
- 31:14Depending on the setup, you can talk to a Kubernetes cluster.
- 31:17It can execute the workflow there.
- 31:19Or you can have a salary queue system processing your tasks and executing them on distributed workers.
- 31:25Because the scalability part, which was one of those features of Airflow.
- 31:30So you can have multiple workers, multiple machines, even several hundreds of them if you want.
- 31:36And Airflow can be installed using all those capacity.
- 31:40So we have salary workers, we have Kubernetes workers, we have scheduler, we have web server.
- 31:44And putting it together is not as simple as you would think.
- 31:49Or actually, you can think that it's complex.
- 31:51And it is.
- 31:51However, we've made, like recently especially, we've put a lot of effort to make the kind of very simple way of installing Airflow.
- 32:00Like, you know, like you just install it and it works.
- 32:02And also, if you want to scale it to like a very complex one, you can also turn on all the knobs, put as many components you want in a way that fits you best.
- 32:12So coming back a little bit to this installation, we have a Docker image.
- 32:17So that's something I also worked for quite some time.
- 32:19Together with Caxil and the other maintainers, we iterated and perfected it.
- 32:24So we have a very nice Docker image that can be used to both run Airflow as it is or build your own custom image, which contains all the new dependencies you want or all the special packages that you want to install, which are needed for you.
- 32:37And then from that, we have Docker Compose, which is kind of a quick start.
- 32:42So you can just, and this is this running Airflow in Docker, this part there.
- 32:46When you run in Docker, does, say, the web server run in one container and the scheduler in another or something like that?
- 32:52That's exactly what this Docker quick start.
- 32:54It's orchestrated, yeah.
- 32:55Okay.
- 32:55Yes.
- 32:55But it's super easy.
- 32:57It's a really quick start.
- 32:59You just download the Docker Compose file.
- 33:01You just run two commands.
- 33:02If you go a little bit down, then there's like a few commands to run.
- 33:06And then off you go.
- 33:07You have all these components talking together to each other and processing the DAGs.
- 33:12And you can start playing with that.
- 33:14It's not production ready, the Docker one.
- 33:16But then there is the next step.
- 33:18So you have a local installation.
- 33:21It gives you Docker Compose.
- 33:22And then I will transfer it to Kaxi because he was working mostly on that.
- 33:26Yeah.
- 33:26So we also have the Helm chart that we did.
- 33:29The first version of Helm chart we released in March of this year.
- 33:32So that's what we recommend for production uses.
- 33:35That uses the official Docker image.
- 33:38So we release like a lot of artifacts for Airflow.
- 33:41And again, the documentation for Helm chart.
- 33:43If you click on documentation again at the top and scroll all the way down, you will see a separate documentation for the Helm chart.
- 33:50All right.
- 33:51So go to Helm chart.
- 33:52Yeah.
- 33:52Okay.
- 33:52Got it.
- 33:53We have versioned all this documentation separately because they are different artifacts and all of them have different release cadence and are released separately.
- 34:02And Helm chart is what we recommend for users because it comes with all the configurations that we have tested it in production environments.
- 34:09Astronomer donated the Helm chart last year and we traded on it a lot of time before we released it.
- 34:16We also, me and Jarek, had a presentation in a recently concluded Airflow Summit.
- 34:20So if users are interested in it, we can probably drop a link at the end of this session, I guess.
- 34:26Yeah.
- 34:27You all just had the Airflow Summit, right?
- 34:28Yes.
- 34:29Yeah.
- 34:29Oh, I have a lot to say about this.
- 34:32All right.
- 34:32Well, tell us.
- 34:33Community is definitely where the majority of my contributions to Airflow come in.
- 34:38So this is our second ever Airflow Summit.
- 34:41So far, it's been an annual thing, but I'm always nervous to say annual.
- 34:45We can't, I don't want to make promises, but it's looking good.
- 34:49Like we'll have it again.
- 34:50So we had our first summit in 2020.
- 34:52We had originally planned to have it be this 500 person in-person event and it's going to be in Mountain View.
- 34:59That's how I got involved because we were looking to host it at the Computer History Museum.
- 35:04And I said, oh, that's really close to where I work.
- 35:06I can like be your liaison to the location.
- 35:09And then, you know, there's a whole pandemic and everything.
- 35:12And we ended up pivoting to a totally virtual event and it was a great success.
- 35:18We did it in partnership with Software Guru.
- 35:20They helped us run the summit last year.
- 35:23And we felt that it was such a good success that we did it again this year.
- 35:28And it just finished up in July.
- 35:30We had 10,000, I think more than 10,000 at this point, registered attendees from all over the world.
- 35:37That's really good for an online conference.
- 35:39And for only the second edition too.
- 35:41We're pretty proud.
- 35:42Yeah.
- 35:42And we had it live streamed in a bunch of different time zones.
- 35:45So sometimes it was more Americas friendly.
- 35:47Sometimes it was more EMEA friendly.
- 35:49Sometimes it was more APAC friendly.
- 35:51And we had all variations of talks.
- 35:53We had ones that were customer use cases.
- 35:57So people who are running Airflow in production or running one of the hosted managed versions of Airflow and what they're using it for.
- 36:06We had people who are contributors talking about their first time contribution experience and why you shouldn't be scared to contribute to Airflow because we're really nice.
- 36:15I promise we are, or at least we try to be, but, and we had more experienced contributors like Yarg and Kaxal talk about some of the more complex things that they've been working on over the past year and everything in between.
- 36:27And there are so many talks and you have the summit page up right now.
- 36:32Actually, all of the recordings and slides for those presentations that had slides available are up there for you to watch.
- 36:40If you go to airflowsummit.org, there's many, many, many hours of content.
- 36:45I highly encourage you to watch whatever sounds interesting for you.
- 36:50Yeah.
- 36:51I think this is great.
- 36:52Like I said, congratulations on having 10,000 registered.
- 36:55Thank you.
- 36:55Yeah.
- 36:56That's pretty amazing.
- 36:57I think there's obviously a big group of people who know that this is like the right tool.
- 37:03I think there's a lot of people who necessarily don't know for sure.
- 37:05Like for example, there's on the Airflow GitHub page, it's 23,000 stars.
- 37:11That's big time.
- 37:12Yeah.
- 37:12Django and Flask are 50, 50 K.
- 37:14So, I mean, that's, that's a lot of people using this and interested in this and so on.
- 37:19I think that the best part about Airflow is the community.
- 37:23And that's like why we have those stars, but also like why we had such a summit.
- 37:27And Kaxal, you were going to say something.
- 37:29Yeah.
- 37:30I was just going to say that if you go by the PyPy stats, we have like 3 million downloads
- 37:35a month or something like that, which is insane.
- 37:38I know a good number of those come from CI and automated processes, but hey, all the other
- 37:43packages also have the same thing.
- 37:45So you can at least compare them between packages.
- 37:47Yeah.
- 37:48It's a relative statement at least, right?
- 37:49Exactly.
- 37:51And likely I mentioned like the biggest part about or biggest greatest thing about Airflow
- 37:56is its community.
- 37:57If you check the new contributors, I think we are to more than 1600 contributors to the Airflow
- 38:04project, which is great.
- 38:05And every day we at least get a few new contributors trying to contribute to the project with whatever
- 38:11they can and they must.
- 38:12And I, again, through your medium, I would encourage people to go to Airflow website.
- 38:17If you find anything, contribute it, fix it.
- 38:20If you have some ideas about hooks, operators, anything, contribute it.
- 38:25And we are there to help you.
- 38:27Not only three of us, there are more than 30, 40 committers and PMC members, and there are
- 38:32users helping users in the Airflow Slack channel.
- 38:35We have more than 16,000, 17,000 members in the Airflow Slack workspace as well.
- 38:40Wow.
- 38:40That's cool.
- 38:41So I actually want to give a quick plug for an Airflow Summit talk I gave this year that
- 38:46was authored by me and a colleague.
- 38:48It's called You Don't Have to Wait for Someone to Fix It for You.
- 38:51And it is about the kinds of contributions that you can make to Airflow because there's all
- 38:56those things that Coxell mentioned.
- 38:58But my personal opinion is that one of the best and easiest ways to contribute to Airflow or
- 39:05any open source project really is to find something that is driving you nuts and to fix it.
- 39:10Or at least to articulate really well what's driving you nuts and what needs to change.
- 39:16Because a really good issue can be just as good of a contribution as a PR.
- 39:21Because you may have just made the foundation for someone else to write a fabulous PR with a really
- 39:28detailed issue.
- 39:29And let me add to that as well because the community is definitely the thing that I love
- 39:34most about Airflow.
- 39:35The people are fantastic here.
- 39:38And we are, all of us, all the committers, we are so much into making, like inviting people
- 39:45to come and to join us or to give back for whatever they got from Airflow.
- 39:50Like it's a free software.
- 39:51Anyone can use it for free.
- 39:53Giving back is just super nice.
- 39:55But we don't stop talking, only talking about them.
- 39:58Because if you see, if you see, scroll down a little bit above, you would see that we also
- 40:03run a workshop during the Airflow Summit.
- 40:07And this workshop is about contributing to Apache Airflow.
- 40:10This year we had like 20 attendees coming and learning in three hours how to make your first
- 40:16PR, how to communicate, how to be present in the community, how to make the most of it,
- 40:23how to be super helpful to others as well.
- 40:26And then we were just, it was like part of it was about coding, but all the rest was all
- 40:32about communication, about speaking to people, about being able to express yourself and all
- 40:37the stuff that you just needed.
- 40:38And it is super important.
- 40:40Who should I ask about this and things like that?
- 40:42I know exactly who you should ask.
- 40:44So actually one of our, one of my favorite stories about this year's Airflow Summit is we
- 40:49had a speaker, I forget her last name.
- 40:50Her first name is Tatiana and she's like a principal data engineer at the BBC.
- 40:54And she went to the workshop last year.
- 40:57And this year she was a speaker at the summit.
- 41:00And her talk about how to basically like kind of debug when crazy stuff is going wrong in Airflow
- 41:06was fabulous.
- 41:08Oh, super.
- 41:08Okay.
- 41:09Yeah.
- 41:09And you can, that's, people can live stream that off the sessions.
- 41:12That's really cool.
- 41:13Yeah.
- 41:14Doing in Airflow, Airflow obstructions.
- 41:15Awesome.
- 41:16So that is an example of that workshop working.
- 41:19Yeah.
- 41:19Yeah.
- 41:20Very cool.
- 41:20Yeah.
- 41:20I was just saying Airflow Summit is also one of a kind conference.
- 41:23It's not like the normal conferences, mainly because we had the local meetup groups hosting
- 41:30that day of the event.
- 41:31So we had like the London meetup group.
- 41:33We had the Bangalore meetup group, Melbourne, Warsaw meetup group.
- 41:37And every, though we were bringing the community together.
- 41:40So let's say the first day was hosted by the London meetup group, which was me, Ash and
- 41:45other folks.
- 41:46We were hosting that event for just for the Monday slot.
- 41:49And then on the Tuesday, there were other PMC members, other community members from Japan
- 41:54hosting that, some from Melbourne hosting that.
- 41:57Similarly, those were the slots.
- 41:58And someday even we had like some sort of overlap because we were trying to cover the
- 42:04Pacific time zone and the Asian time zones, which was incredible because now you have tons
- 42:10of content for the Airflow users to watch out.
- 42:12Also, we had two community days.
- 42:15We started from Thursdays.
- 42:16So we had Thursday, all the talks about community, how you could make the contributions and stuff
- 42:22like that.
- 42:23Friday, we had that workshop.
- 42:24And then from Monday to Friday, there were more about the Airflow use cases and why Airflow
- 42:302.0 was the big milestone for the project and what we are planning ahead for Airflow and
- 42:36stuff like that.
- 42:37There's a ton of stuff here.
- 42:38I think people could watch for the rest of the year and study this and get a lot out
- 42:42of it.
- 42:43It's true.
- 42:43I do think so.
- 42:44And we actually even had a networking event there Friday night.
- 42:49And that was a blast, actually.
- 42:51It was.
- 42:51The networking this year was like people learn how to use it online.
- 42:55And that was like, well, not maybe as good as physical conferences.
- 43:00So I'm looking forward to next year, which hopefully will be going to be partially at least a physical
- 43:05event.
- 43:05But it was good enough.
- 43:07And I think that was really cool to talk to those people about all the different things,
- 43:12not only Airflow.
- 43:13So we are not only Airflow and not only Python and not only programming, but also people.
- 43:19Yeah.
- 43:20I feel like this is a project that would be easy to contribute to in the sense that if
- 43:25I'm going to say contribute as a newcomer to Django, that's going to be hard because that's a highly
- 43:30polished single piece of software.
- 43:32And if you're going to make a change that affects millions of people and it's not easy.
- 43:37Whereas here, if you want to add some kind of integration and it didn't exist before, you're
- 43:41not going to break anybody's code.
- 43:43You don't want to work with a bunch of legacy code.
- 43:44There's a bunch of sort of broad but shallow places people could jump in and participate.
- 43:49Well, and if people, if a newcomer does want to come in and like really jump into the deep
- 43:54end, we do have this concept called AIP, which stands for Airflow Improvement Proposal.
- 44:00And it kind of sets you up to not run into heartbreak if you open this, what you think is an
- 44:06amazing PR and we're like, oh, no, no, no.
- 44:08Hold on.
- 44:08We're not ready for that.
- 44:09Because it's almost like writing the outline before you write your essay.
- 44:13I know it sounds kind of dry, but what it really is, is it's an opportunity to fully flesh out
- 44:18this amazing idea you have and share it with the community and the community will give you
- 44:23feedback and they will be productive about it because if they're not, they're not abiding
- 44:28by community code of conduct.
- 44:30Yeah.
- 44:30I find it very unfortunate.
- 44:33I feel really bad if people come and do a PR to some project that I have.
- 44:37And granted, these are all very small open source projects.
- 44:39But if they come and they actually do the work and the first I know about it is, boom, here's
- 44:43a PR.
- 44:43Yeah.
- 44:44That's just not in the same zen of what I'm trying to accomplish with this.
- 44:49And it's going to break the thing that makes it special.
- 44:51It's a bummer.
- 44:52So I have to reject it, right?
- 44:53But you don't want to.
- 44:54Yeah.
- 44:54It'd be much better to say, I have this idea.
- 44:56If I built this, would you want it?
- 44:58You know, do you want the puppy?
- 44:59Here's a puppy for Christmas.
- 45:00Yes, exactly.
- 45:02This is precisely what we are teaching people at those workshops because it's not obvious.
- 45:07If you come from outside, you don't understand that.
- 45:09We are not only teaching people about contributing the code, but also how to find yourself there,
- 45:15like how to be empathetic, how to think about, put yourself in our shoes.
- 45:20And on the other hand, how to tell what he wants to tell in the way that we will understand
- 45:25it.
- 45:25Because it's sometimes really different worlds, different people, different backgrounds, different
- 45:29expectations and assumptions.
- 45:31So all this is the communication is that I'm a software engineer.
- 45:34I love to do software engineering, but like 30, 40, 50% of my time is communication.
- 45:40It's not actually coding.
- 45:42And this is cool.
- 45:44I related to this, I actually want to call out a really important Apache value that I
- 45:49think that Airflow embodies, which is the concept of the importance of community over code.
- 45:55And I really feel that the Airflow project lives that value.
- 45:59And folks in the community really are trying to foster a positive community because they
- 46:05understand that if the Airflow community is not healthy, then the Airflow code will not
- 46:11live on.
- 46:12It doesn't matter.
- 46:13Yeah, it doesn't matter.
- 46:15And if folks have questions about that, I do want to acknowledge that I am the one woman
- 46:21in the room.
- 46:21I am often the one woman in the room when it comes to Airflow.
- 46:26And I would love to see that change and have more gender diverse folks come join.
- 46:32And so if you are someone who identifies with that and wants to hear Leah's unfiltered views
- 46:38on the community, feel free to reach out to me in the Airflow Slack or on my Twitter.
- 46:42And like I said, I do think this is a project that if you want to get into open source, it's
- 46:46one that has relatively low barriers, technically speaking.
- 46:49Yes.
- 46:49Oh, yeah.
- 46:50The keynote talk I gave in the Airflow Summit on Thursday, the first talk.
- 46:54So if you go to the Airflow Summit page, the first talk, then I talk about my journey as
- 47:00well.
- 47:01Because I was very afraid of contributing to open source because it feels intimidating at
- 47:05first on everything will be public.
- 47:08Oh, who knows if I screw something up?
- 47:10What would people say?
- 47:12On my permanent record.
- 47:14Yeah.
- 47:15And I didn't know Python or didn't know it proficiently.
- 47:20So I talk about my journey of how I did it.
- 47:22I talk about 10 minutes about that and then how a new user can start contributing to the
- 47:28project.
- 47:28Because Airflow is a relatively still a larger code base.
- 47:32And there are a lot of areas that people can target because if you try to learn everything
- 47:35at once, it is going to be very difficult.
- 47:37We have Helm charts.
- 47:39We have Docker images.
- 47:40We have scheduler, which is code to Airflow.
- 47:43We have executors.
- 47:44We have the CLI, REST API, and a lot of things like that.
- 47:48So there are a lot of room for people to get expertise in a certain area.
- 47:52And then if you start including all the integrations, then it's a whole piece, right?
- 47:56You can just add your own integration and be an expert at that and become a contributor,
- 48:01a PMC member just with that contributions.
- 48:04Well, and in the interest of empathy, I would like to share that I do not know all of these
- 48:09parts.
- 48:09I think the part I'm most familiar with is the Google provider.
- 48:13And I have never touched the Helm chart and it scares me because I haven't taken the time
- 48:17to learn what it's all about.
- 48:18But the good news is that other community members know and I know that I can look to them for
- 48:23help when I do need to mess around with it.
- 48:26Yeah, that's fantastic.
- 48:27That's the beauty of the project, right?
- 48:28If everyone knows everything, then why are we all here?
- 48:32Each one of us knows their part, then that's the community.
- 48:36Otherwise, it's not a community project.
- 48:37Yeah.
- 48:38Yeah.
- 48:38Yes.
- 48:38We're getting short on time.
- 48:39I do want to touch on a couple of things that I think we haven't got a chance to touch
- 48:43on that are really important.
- 48:45One, let's talk about the user interface because one of the ways you all position to this is
- 48:51you don't want to do this all with just cron jobs and like sort of little scripts that are
- 48:55put together and run on weird random triggers.
- 48:58And one of the real big benefits is you have this really beautiful UI for all sorts of visualization
- 49:03of like running workflows and all kinds of stuff, right?
- 49:06You want to tell us about that?
- 49:08I'll do the simple version because I think that Kaxel and Jarek know more about it than me,
- 49:12but I'll tell you the two things I'm most excited about.
- 49:15One of them is that it just got a huge makeover with Airflow 2.
- 49:18So if you're an Airflow user and you haven't upgraded to Airflow 2,
- 49:21if you need one reason alone, it is that the UI is so much prettier and it is much more responsive.
- 49:28And as a former cron user, I'll say that the best, easiest benefit you get from this
- 49:35is you can just see what's failing.
- 49:36If you don't have to dig around and try to figure out what's missing,
- 49:39like you know that something went wrong.
- 49:41All right, Jarek and Kaxel, that's my, I'm off my soapbox now.
- 49:44Yeah, basically you have all the information you need, all the historical view in front of you.
- 49:48Like if you want to see which task failed historically, you could just check the tree view.
- 49:52And then this is the graph view where you can see how your task is proceeding.
- 49:55Plus we now have auto refresh, like Leah mentioned from 2.0,
- 49:59which is like you don't need to press the refresh button,
- 50:01which was a bit annoying for the Airflow 1.10X version, which is very good.
- 50:05Your task will continue.
- 50:06You can see the progress that the Airflow is continuing this task.
- 50:10If you click on that task, it will show you the logs of that task.
- 50:14So everything is very intuitive and easy to monitor.
- 50:18For people who are listening and are not watching the live stream,
- 50:21you can go and for example, in the graph, it'll show you all your tasks that you would do,
- 50:27like download this file or run this bash script or whatever.
- 50:30And then it actually shows you how they're working together.
- 50:32And then they're colored as you progress through this DAG of tasks, right?
- 50:36So you can actually visually see, was this one skipped?
- 50:39Was this one successful?
- 50:40Which one failed?
- 50:41How far are you visually as a graph?
- 50:43Which I think is awesome.
- 50:44Yeah.
- 50:44And one of the interesting thing over there is to understand the dependencies,
- 50:48which was very interesting when I initially started with Airflow,
- 50:51that for a user or for a company to understand what all the tasks they are working on
- 50:56and in a single flow, how does that dependency graph work on?
- 51:00If you're depending on a data from a single client, how does that go to a dashboard?
- 51:04So that end-to-end view, like it's an actual pipeline of sorts that you can see.
- 51:09Yes. And just to add on that, so the visualization of the data flow is like super important
- 51:14because then you can, with a glance, you can see what's going on
- 51:17and you can go to any part of it and focus on that and understand what's going on.
- 51:22However, I will come back to kind of the roots
- 51:25because Airflow doesn't have a way by default to define those flows visually.
- 51:33You can see them visually, but they are all defined as Python code.
- 51:37And this is like the beauty of it.
- 51:38And that was a very, very deliberate choice.
- 51:40And this is the reason why we are at the Python talks today,
- 51:44because Airflow is all about Python.
- 51:46So this visualization that you see here are really reflection of the code that you wrote as a writer.
- 51:53And it means also that the common language between people using Airflow,
- 51:57different parts of it, is Python.
- 51:59This is the common language that we're using.
- 52:01And this makes it so powerful.
- 52:03And the visual part is pretty much an addition.
- 52:07And it's necessary.
- 52:08And it's more kind of result of the Python code which is being written.
- 52:12A lot of workflow systems try to go in reverse, right?
- 52:14They're like, here's your draggy, droppy set of tasks and options.
- 52:17You drag it all together.
- 52:18Then you press go.
- 52:19Yes.
- 52:20This lets you live at the code level.
- 52:22This all breaks at the very moment when you want to have some custom work.
- 52:27Because if you are used to the drag and dropping, you will not do coding.
- 52:31You will not code the kind of customization that you want to do.
- 52:35You will ask someone else to do that.
- 52:37In Airflow, this is quite reverse.
- 52:38I mean, everything is Python.
- 52:40Everything.
- 52:40Dependencies are Python.
- 52:42The code itself is Python.
- 52:44The blocks are Python.
- 52:45But you can also write your own.
- 52:46In the same place where you define your DAG, you can write your own custom operator
- 52:51without having to use a black box operator of sorts.
- 52:55And you don't have to leave the box of working on Python while doing that.
- 53:00And this is so powerful.
- 53:02I think this is the way why it is so popular between data engineers all over the world.
- 53:07I think this is like one of the most popular workflow orchestration engine in the world right now.
- 53:12That's it.
- 53:13I don't have hard data on that.
- 53:14So it's just a feeling.
- 53:16But I think that's the case.
- 53:18I mean, we did have 10,000 people at the summit, Jarek.
- 53:21Yes.
- 53:22Yeah, for sure.
- 53:23And while it is written in Python, you can use the bash operator to run like your Java code,
- 53:28for example, or Scala or whatever.
- 53:30So while everything is in Python, you can use it to run any other languages too.
- 53:36You can run Docker image, Kubernetes task.
- 53:38Because a lot of those workflows are also, okay, we have Kubernetes.
- 53:42So we run everything in Kubernetes.
- 53:44We run them as Docker containers.
- 53:45And that's the only way you can do that.
- 53:48Airflow can do that as well.
- 53:49No problem whatsoever.
- 53:50There is Kubernetes pod operator.
- 53:52You can spin off a new Kubernetes pod to run your task.
- 53:55But you can also have a Python code, which is very easy to put together and play with and run locally without all the overhead of building the Docker images and making them available to run you as a task.
- 54:07So, so much more extensible and powerful.
- 54:11Yeah, that's a very good point.
- 54:12There's a lot of escape hatches to bring in other technologies.
- 54:15That's cool.
- 54:15Yeah.
- 54:16Let me give people just a super quick sense of what it's like to write code for this, this Python code.
- 54:21So you would say with DAG, with directed acyclic graph, and you give it some details.
- 54:26And then you create these various tasks, like a task might be a bash operator or something like that, or like you said, a Kubernetes pod or whatever.
- 54:34And then you just run them.
- 54:35One thing I did want to ask you all about, like, what is this T1 double arrows into list of T2, T3 for the tasks?
- 54:42Ooh, good question.
- 54:44So you had those tasks matched to variables called T1, T2, and T3.
- 54:49And this is how that visualization is defined, using those, like the bit shift operators in Python.
- 54:55So this one would say that T2 and T3 run after T1, and they run in parallel.
- 55:01And there are different ways of setting dependencies.
- 55:03If you scroll down or just search for setting up dependencies on the right side of your, on the right side.
- 55:09Yeah, setting up dependencies.
- 55:10Yeah, there you go.
- 55:11There are different ways you can set those dependencies between tasks.
- 55:14You could do T1-test-do-do or T1.setupstreet.
- 55:19You can, like, right shift.
- 55:20You can left shift.
- 55:21You can double bit shift as a transitive type thing.
- 55:24It's set upstream.
- 55:25Okay.
- 55:26And the beauty of that, again, is that you can, this is all Python code.
- 55:30Those are custom operators.
- 55:32The left shift and right shift, they are just custom Python operators over with them.
- 55:36Right.
- 55:36And you can override them in the task, right?
- 55:38Just like pathlib overrides forward slash to mean, like, combine parts of the path, right?
- 55:43Wouldn't probably recommend that if you don't know about Airflow that much.
- 55:47But the better thing there is that you can actually programmatically build the tasks and build the relationships.
- 55:55So this is not something that is predefined in one file in the declarative way, like it's an XML file or JSON.
- 56:00This is a Python code.
- 56:02So you can pretty much dynamically build the DAG.
- 56:05So very complex.
- 56:07Like we saw, like, you know, the DAGs, which were like thousands, thousands of nodes built with like 200 lines of code because you could build those tasks.
- 56:16You know what, which relationships you want to build in what way, like in for loop.
- 56:20It's very hard to have a conditional in a JSON file or a XML file.
- 56:25Yeah.
- 56:25That's the thing.
- 56:26Or loop.
- 56:27Actually loop in JSON file is like, no.
- 56:30I mean, there is no way to do that.
- 56:32I mean, we do have XSLT.
- 56:33You could go crazy.
- 56:34Come on.
- 56:35Yeah.
- 56:35Yeah.
- 56:36Please no.
- 56:37And also from Airflow 2.0, this is an explicit way of setting dependencies, but from Airflow 2 and onwards, there's also an implicit way of having dependencies, which is like,
- 56:48if you say that your mesh operator takes an input from another task, then Airflow sets dependencies between them implicitly because you are depending on an output of another task.
- 56:59So it knows.
- 57:00Yeah.
- 57:01That makes a lot of sense.
- 57:02Cool.
- 57:02All right.
- 57:02So I think just two really quick things before we wrap it up.
- 57:07We are short on time here.
- 57:08One is we talked about the web UI for the stuff we're looking at, but there's also, you will describe a rich command line utility.
- 57:17To perform complex surgeries on DAGs.
- 57:20Okay.
- 57:21Why would you perform a surgery on one of these things?
- 57:24And what is this all about?
- 57:25Who wants to take that one?
- 57:26Oh, I don't know that I've done surgery with the CLI, but I have used the CLI to give me information about my environment to figure out when things are misbeheaving.
- 57:36Yeah.
- 57:36Okay.
- 57:36Cool.
- 57:37Like for diagnosis and stuff like that.
- 57:39Yeah.
- 57:39Like, cause we have, there's one command list DAGs and it also shows you how long the DAGs are taking to load.
- 57:46So you can kind of see if one of them is your problem DAG.
- 57:49If it's taking way longer to load than the rest, that usually means that I've made a mistake.
- 57:54Yeah.
- 57:55Yeah.
- 57:55That command also gives you the parsing time and everything like that.
- 57:58So it will tell you that it took five seconds to parse your DAG file, which means something is wrong in your DAG file.
- 58:04You are probably importing a lot of things or doing some database calls on the top of your file, not inside the objects.
- 58:11Gotcha.
- 58:11So you could find those sort of issues.
- 58:13Also, you could use Airflow backfill CLI command to run all the backfilling of data if you got the data today.
- 58:20And if you want to run it for last one year or so.
- 58:22But also it's what is not mentioned in the document.
- 58:26There is this, well, it is mentioned in the documentation.
- 58:28We have also a very, very powerful and rich and very well written API.
- 58:33So we have a stable Assov Airflow 2.
- 58:36That was one of the improvements implemented.
- 58:38So if you go to Apache Airflow, yeah, and scroll down on the left, yes, not this one, this stable.
- 58:43All the way down, yeah.
- 58:44Even below, there was like stable REST API.
- 58:48Yeah, very good.
- 58:49Yeah, yeah, yeah, gotcha.
- 58:50Okay.
- 58:50Yeah.
- 58:50This API is like written in open API standards, which means that all the tools which you can imagine for like managing access, for trying out things, for testing the API calls, all the beautiful documentation that you see here with examples, this is all automatically generated.
- 59:08From our API.
- 59:09This is super cool because you can actually, and this is surprising.
- 59:13You said that the UI is fantastic.
- 59:15And yeah, it is.
- 59:16But there are some companies who have their own UI, their own ways of looking at the processing pipelines.
- 59:21And many, many, we've learned during the Airflow Summit, many of those companies, they actually build their own UI.
- 59:27They don't use Airflow UI at all.
- 59:29They just use the engine to execute it.
- 59:31Right.
- 59:31Maybe you want to integrate it into some larger thing they already have or something, yeah.
- 59:35Exactly.
- 59:35And this API makes it possible.
- 59:38So you can just query which DAX you have, which are the relationships, how this all works, which is successful, which not.
- 59:44And then you can build beautiful UI or even ugly UI if you want.
- 59:48But the UI, that is something that you're used to without looking even at the Airflow UI.
- 59:53And this is also super powerful.
- 59:55Yeah.
- 59:55And this is straight up REST API.
- 59:58So while Python is awesome, if you're not a Python person, but you still want to adopt this, here's a way to integrate with it.
- 1:00:05Right.
- 1:00:05Absolutely.
- 1:00:06And we have already started creating clients in different languages, like we have a Java client for Airflow built on this API spec.
- 1:00:15Users can create their own APIs for a specific language because it, under the hood, uses OpenAPI.
- 1:00:20So you can auto-generate clients for different languages.
- 1:00:23Yeah.
- 1:00:24Fantastic.
- 1:00:24All right.
- 1:00:25I think that is about time for us.
- 1:00:27I did want to point out that Astronomer and AWS, but Astronomer, where you work, Axel, is a sponsor.
- 1:00:34So if you want to run sort of Airflow as a service, that's kind of your job, right?
- 1:00:40A hundred percent.
- 1:00:40And also we, Astronomer, has their own registry.
- 1:00:44So if you do open registry.astronomer.io, it makes it very easy to search for built-in providers that are baked inside Airflow.
- 1:00:52Or if users create and maintain their own providers, it is very easy to search that as well.
- 1:00:58I just posted a link if you want to check out.
- 1:01:02One comment on that, because we also have Google Cloud Composer.
- 1:01:04So we have Astronomer, AWS, and Cloud Composer.
- 1:01:08These are like big embrace of Airflow as a service.
- 1:01:11For us, it's like you can choose either you run it on your own, you run it using Astronomer, which have like great expertise in everything.
- 1:01:19Because we have lots of people from Astronomer or our communities.
- 1:01:21Then there are Amazon people.
- 1:01:24Then there are Google or Amazon offering and Google offering.
- 1:01:27And you are free to choose whatever you want.
- 1:01:30Like how you want to run Airflow.
- 1:01:32And you can move probably if you decide you need to move.
- 1:01:34Yeah.
- 1:01:34Absolutely.
- 1:01:35That just has to do with the infrastructure.
- 1:01:36The DAGs will be the same no matter where you take them.
- 1:01:40You might have to do a few changes when it comes to like auth and making sure your keys are up to date.
- 1:01:45Cool.
- 1:01:46All right.
- 1:01:47Let's wrap this up with a little bit of future looking.
- 1:01:49Just whoever has the right visibility in our group here.
- 1:01:54Just, you know, where are things going in the future?
- 1:01:55People are excited about Airflow.
- 1:01:57Like what can they look forward to?
- 1:01:59There's a really good talk from the Airflow Summit that's called Looking Ahead Beyond Airflow 2.0.
- 1:02:04That is with Ash from Astronomer and Ajemal from Google.
- 1:02:08And I think the thing that Ash said over and over again is, well, there is no roadmap, but we do always have things going on.
- 1:02:16So I'll turn it over to Caxon.
- 1:02:17No promises.
- 1:02:18No promises.
- 1:02:19But there are lots of that.
- 1:02:22So yeah, we pretty much know the direction we are heading to.
- 1:02:25So we want Airflow to be the orchestrator you want to use for whatever workflows you want to run.
- 1:02:30That's it.
- 1:02:31And there are lots of things like to happen in order to get there because we are so specialized on one hand on what we are opening up.
- 1:02:39But we are on the road to really make it easy to accommodate more use cases, make it easier to run, make it faster, make it serve those cases which currently cannot be served because of some reasons, historical reasons mainly.
- 1:02:55This is definitely some direction we are heading to open up to even more cases without losing the single focus.
- 1:03:01Like we want to be great at scheduling tasks and orchestration.
- 1:03:05That's it.
- 1:03:06We don't want to do processing.
- 1:03:07We don't want to go into this direction.
- 1:03:09That doesn't make sense for us.
- 1:03:10We want others to do processing and we will do orchestration the best way it's possible.
- 1:03:15Yeah.
- 1:03:15And the two immediate things that we are already working on and we are almost close to merging it on the main branches, making the Airflows schedule more powerful.
- 1:03:24That is a user who will have more power than just like expressing it in Cron.
- 1:03:30Users will also be able to say run it on the third of the third trading day of the month or something like that.
- 1:03:37Like that level of powerful timetable we want to provide to the users.
- 1:03:42We call it timetables.
- 1:03:43We will have Cron timetable.
- 1:03:45We will have time delta timetable of sorts.
- 1:03:47We are figuring that out.
- 1:03:49But we'll have that plus something called deferred operators.
- 1:03:53I mentioned about the sensors which are currently we put a book for the API call and see until it succeeds.
- 1:04:00We are going to have a new component called trigger that will use Python's async library to use resources in a more optimized manner.
- 1:04:10Instead of polling, you just wait for it to happen and then boom, off it goes.
- 1:04:13Yeah.
- 1:04:14Okay.
- 1:04:14That sounds cool.
- 1:04:15Just one comment to this scheduling because those great examples.
- 1:04:18One of the cases we want to serve, there is a real astronomer, not the company, real astronomer using Earthflow.
- 1:04:24And he wanted to start DAX when there is a sunset and sunrise.
- 1:04:28And, you know, when you are astronomer and flying around Earth, that's a little bit complex.
- 1:04:33So the whole scheduling is going to be there to implement this astronomer request.
- 1:04:38Yeah.
- 1:04:39Fantastic.
- 1:04:39It sounds really useful.
- 1:04:40All right.
- 1:04:41Well, I think that's it for covering Airflow.
- 1:04:44But let's quickly wrap up with, I guess, just one of the questions since we're a little bit over time that I usually ask at the end.
- 1:04:50So I'll ask you about your editor.
- 1:04:51Jarek, if you're going to work on Airflow and other stuff, but what editor do you use for Python?
- 1:04:55On a daily basis, I use IntelliJ, Ultimate.
- 1:04:58That's my favorite editor.
- 1:05:00However, very, very frequently, my favorite editor is VI.
- 1:05:04I mean, I'm an old type guy and VI is always when I have to do something quick.
- 1:05:09Somewhere where I don't have the editor started, VI is there.
- 1:05:14And I, you know, have it in my, you know, like fingers.
- 1:05:16I know how to quit VI.
- 1:05:17It's easy.
- 1:05:18I can learn you.
- 1:05:19I can teach you, no problem.
- 1:05:21Fantastic.
- 1:05:22Yeah, I love that joke about random strings.
- 1:05:24Kaxel?
- 1:05:25For me, it's PyCharm.
- 1:05:27I love PyCharm.
- 1:05:28It's debugging.
- 1:05:29It's going to the source code.
- 1:05:31And those intelligent habits, QSOA.
- 1:05:34Just a big fan of PyCharm.
- 1:05:36Right on.
- 1:05:36I use a combination of VS Code.
- 1:05:39And I also have Southspot for Vamble.
- 1:05:41Yeah, very cool.
- 1:05:42Vamble if it's going to be fast.
- 1:05:43VS Code if it's not.
- 1:05:45Yeah, we're going to be here for a while.
- 1:05:47Let's get down to it.
- 1:05:48Yeah.
- 1:05:48Right on.
- 1:05:49Well, thank you all for being here.
- 1:05:51It's been really great.
- 1:05:52Final call to action.
- 1:05:53People want to get started either using Airflow or contributing to Airflow.
- 1:05:57What do you tell them?
- 1:05:58Oh, I tell them to go to the community page on the Airflow website.
- 1:06:02And I tell them to sign up for the dev list and to join the Airflow Slack.
- 1:06:07Yeah.
- 1:06:07Fantastic.
- 1:06:07All right.
- 1:06:08Well, thanks again.
- 1:06:09Thanks for being here.
- 1:06:10Thank you.
- 1:06:10Thank you for inviting us.
- 1:06:12It was a great time.
- 1:06:13Yeah.
- 1:06:13Thank you.
- 1:06:14Thanks.
- 1:06:14Bye.
- 1:06:14Bye.
- 1:06:15Bye.
- 1:06:15Bye.
- 1:06:15Bye.
- 1:06:15Bye.
- 1:06:16This has been another episode of Talk Python To Me.
- 1:06:18Our guests in this episode were Jarek Potik, Kaxal Naik, and Leah Cole.
- 1:06:23And it's been brought to you by us over at Talk Python Training, as well as the transcripts
- 1:06:28have been brought to you by Assembly AI.
- 1:06:30Do you need a great automatic speech-to-text API?
- 1:06:33Get human-level accuracy in just a few lines of code.
- 1:06:36Visit talkpython.fm/assemblyai.
- 1:06:39Want to level up your Python?
- 1:06:41We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:06:45Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:06:50And best of all, there's not a subscription in sight.
- 1:06:52Check it out for yourself at training.talkpython.fm.
- 1:06:55Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
- 1:07:00We should be right at the top.
- 1:07:01You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the
- 1:07:07direct RSS feed at /rss on talkpython.fm.
- 1:07:11We're live streaming most of our recordings these days.
- 1:07:14If you want to be part of the show and have your comments featured on the air, be sure to
- 1:07:18subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:07:22This is your host, Michael Kennedy.
- 1:07:24Thanks so much for listening.
- 1:07:25I really appreciate it.
- 1:07:26Now get out there and write some Python code.
- 1:07:28I'll see you next time.
- 1:07:48Bye.
- 1:07:49Bye.
- 1:07:49Bye.
- 1:07:49Bye.
- 1:07:49Thank you.