Data Flow design, asyncio patterns, docs & demos

28:352 speakers
28:28
duration
10
chapters
2
speakers
7
Tasks
data flowasyncioevent typesdocs & demostunersInnerSourcesubprocess I/O

Speakers

2
Speaker A95%21 turns
Speaker B5%21 turns

Key ideas

6
  • Current data flow API lacks visibility and is unfamiliar to typical Python users.
  • Adding event types will enable runtime visibility and progress updates inside data flows.
  • A more Pythonic, gradual path (no-loop → loop-based → async loop → full data flow) helps adoption.
  • An asyncio 'concurrently' loop pattern is a useful foundation for running operations and watching subprocess output.
  • Docs, tutorials and demos are essential to explain why and how to use data flows.

Key highlights

6
  • Proposal to add event types so flows can emit progress updates (e.g., when an input moves between operations).
  • Explained and favored a 'concurrently' asyncio wrapper to run multiple tasks and read subprocess stdout/stderr concurrently.
  • Suggested a staged tutorial path: standard/preprocessing → loop-based → async loop → full data flow, with demos at each step.
  • Actionable plan to produce docs and demos for data flow patterns and event types.
  • Coordination planned with an Intel/oneAPI contact and InnerSource portal to gather use-case feedback.

Decisions

3
  • Adopt a staged learning path and examples (no-loop → loop-based → async loop → full data flow) to ease adoption.
  • Prioritize simple, readable tuner implementation (GridSearch-style) as the first tuner.
  • Produce documentation and demos to clarify data flow benefits (visibility, modularity, maintainability, swapping implementations).

Action items

7
  • Complete the tuner (stabilize tuner API) before betaby the next meeting
  • Write a tutorial showing continuous deployment of data flows and scraping service with Kubernetestoday / by Friday
  • Document the 'concurrently' function and its usage (subprocess readlines and wait handling)
  • Produce docs and demos illustrating: standard preprocessing, loop-based preprocessing, async loop, and full data flow
  • Sync with the oneAPI/Intel contact to gather feedback on use cases

Terms

7
data flow — programming model where data moves through a graph of operations; here used for orchestrating ML/data-processing steps and enabling visibility/parallelism.
event types — typed runtime notifications emitted by the data flow (e.g., input moved, operation started/completed) to enable visibility and visualization.
asyncio — Python library for asynchronous I/O and concurrency using async/await; used here to run tasks concurrently and watch subprocess output.
concurrently (pattern/function) — a wrapper loop around asyncio tasks that tracks active tasks in a dict and waits for completions, useful for running multiple coroutines/subprocess I/O.
subprocess readline/wait — reading stdout/stderr streams concurrently while also awaiting process completion — a common pattern solved here with asyncio tasks.

Main content

10 chapters · 28:28
0:01

1. Introduction and df_event refactor

Speaker A0:01

So, oh man, this computer's hard drive started dying too. Okay, so where is that? Get similarity. No, okay, so it's just the inner source stuff. Okay, um, okay, so where did that go? I had a branch here. Give repo similarity. I was working on— oh, the— no, I was working on cleanups. That's not right. What was I working on? Oh, this df_event refactor here.

So I was working on this stuff to do— to add event types to the data flow code. So essentially, when you're running a data flow, you would get, you know, this is the standard. This is what you get right now. Let me just open this thing. No, I didn't add the code, did I? Let's see. Let's see. I don't know if this is really going to help this discussion. But yeah, so I was working to add these event types.

So essentially, we would see— because right now, we only get the results of the data flow when it's complete. And it would be nice to be able to say, OK, we want to get progress updates, basically, right? So like, hey, an input moved from one— operation to the next, right? Because for purposes of, for example, visualizing the data flow or tracking what's going on, you would want to know, you know, what's going on inside the data flow, not just whether it's done or not, right?

So I was working on adding event types, and sort of as part of that work, I was explaining— I was playing with, you know, how we might implement a, you know, a more Pythonic API around the data flows. And I think the thing that I consistently keep running into is the flow definition, right? And the way that we're linking together.

Yeah, for example here, right? The way that we link together, this is just not ideal, you know? It accurately describes the flow, but it's not anything like anybody is used to, right? And that's our main issue with that stuff. And so I was thinking, if we made it fully Pythonic, you know, how do you sort of bridge the gap between the full, like, the data flow and then a more familiar Python workflow?

And essentially, what I've come up with so far is sort of like, you know, you have your functions. Right? And let me just write some code. Or where's this code? So you have your functions. And, you know, these are our operations here. And we— okay, here's your data flow. Here's the event types. I'll put it up here with the functions.

So essentially, what this does is it takes inputs. And so it takes this carnivore function. It says carnivore takes an integer value, and then it returns a string of dead or beef. And then this beef to feed— this is just a very basic data flow. So the beef to feed says basically just does a replacement so that if you have 42, you end up with beef. If you have beef, you end up with feed.

And then the last one basically just says, you know, is, is, is the string feed, or is feed in the string, right? Um, so, uh, this is true and this is false. Uh, that will just be false. Um, so that's essentially, you know, this will be our flow, is our flow comes 42, beef, beef, feed, feed, true, and then otherwise essentially we hit false.

5:47

2. The concurrently helper and subprocess patterns

Speaker A5:47

Um, so if greater than 42, greater than or equal to 42, we end up with true. Less than, we end up with false. And so thinking about the way that we might do this, I think what we end up with is almost something that's kind of like a sort of simplified— let's see. It ends up being— so there's this concurrently function. Have you seen that function? Let's see.

Speaker B6:30

No.

Speaker A6:31

OK, so— Okay. So this thing is pretty dang handy. Oh, is it not? Is there no— there's no docs for it. Well, that's sad. Okay, let me just take us to the function. That's weird. Oops. Here, I'll just— the function's right here. All right, this concurrently.

Okay, this thing needs to be documented. And essentially what it does is it's this loop where— where is— okay, wait. There is git show. It becomes really obvious what it is with one of these things. It makes it really easy to do several things at the same time using the asyncio APIs. It's a slight wrapper on top of that. Where is— it's in this run operation branch. Branches.

Yeah, so run command. All right, so run command. All right, this is a pretty good— so let's just not look at the version that is all. Okay, so essentially what this does is, and here's the example, but basically this is a wrapper around, you know, running a subprocess run but using asyncio. It's this function here, and so, and it uses that concurrently function here. And so, come on, let's see the whole thing. And there we go.

9:15

3. Async task loop and mapping to data flow logic

Speaker A9:15

All right, so, so the way that it ends up working is that you create this dictionary where you map these task objects to a— to a particular— it's basically like the task is the key and then the value is, you know, whatever you want it to be. But the task is sort of the unique object in this, right? And so whenever— and it's the unique object because whenever it completes, it's going to be removed from this dictionary. So you essentially end up with work as your dictionary of all the things that you're doing right now.

So if you were executing a bunch of different operations concurrently, they would all be in this work structure. And so— and I think this might be what the— I think this might be what the data flow stuff calls under the hood, or if not, it was sort of an abstraction that was written later.

So essentially, this is how we can use that for running a subprocess and basically making it so that we can add— we can create a task for the readline function on both the standard out and standard error of a subprocess. And that way, so we say basically, you know, we create the task, we grab the read— we call the ReadLine, we create the coroutine for the ReadLine, we create a task out of the coroutine, which is sort of as soon as you do CreateTask, it'll start running it in the background if there's a running loop, or at least it'll submit it to be run.

And then you assign it to work, and we basically say, okay, so output would be stdout or standard error.ReadLine. So this one is wait, and this one is— this is a task for when the process completes, we'll get the result is— or what is it? Oh, the event will be WAIT. And the result will be whatever the return code of PROC.WAIT is, or whatever the return value of PROC.WAIT is.

So this allows us to— because this is sort of a frequent problem if you're familiar with running subprocesses, is, OK, I would like to watch the output of the process, but I also need to— know if the process errored out, right? Yeah. And so this solves that. This sort of solves that problem. And this is sort of my— this is one of my favorite uses of asyncio is for this, because this is just like frequently a problem.

Um, and so essentially, yeah, you end up with this, this, this loop basically where you're like, okay, well, while, you know, while I'm— while I have work be in the body of this loop, right? And when you break out of the loop, then cancel any work that remains.

So, um, so what I'm thinking is, I mean, this is a very— this is essentially what we do with the data flow, right? Is we basically say, you know, while I have operations to run, you know, run them. And then in the body, we decide what more operations need to be run. Right.

Um, and the logic, the logic that we decide which operations need to be run by is really, you know, the flow, right? That is our— the flow modifications that we're doing, um, you know, here, right? This is really— this turns into a bunch of essentially, you know, this stuff maps to what, what, what if statements we would write.

Speaker B12:59

Right. Yeah.

13:00

4. Hybrid approaches: loop → async → full data flow

Speaker A13:00

Um, so I'm thinking, you know, there's some kind of hybrid here where we could sort of define a, uh, a way where, you know, we, we sort of, uh, offer up a pattern, you know, like, uh, we offer up a pattern and then this can— and a few helper functions, right, that help people write. You know, maybe it's not a full data flow, but it is this loop, right? And if they're operating in this loop, then they can easily transition from the loop-based approach to a full data flow-based approach, right?

Speaker B13:42

Yeah.

Speaker A13:43

And I'm not sure, you know, I'm not— I'm still— this is the only thing that I've come up with so far. But because I think it maintains our thing of like, you know, this concurrent environment, right? Which I think is— that I think is a very important thing. I know it's not something that people are always used to, but I think it becomes very important as soon as you start doing network operations, right?

And if you ever— the problem is if you ever break the async thing, now you're— now you can't do this, for example, right? As soon as you write a non-async function and you need to call a subprocess and watch its output, and this is like basically, for me, it basically always ends up being this use case is why I end up returning to asyncio because I'm like, okay, well, I need to write a bunch of code to do XYZ.

And all of a sudden I'm like, well, there's this command line tool that fits really well into this portion of this, or else I'd have to rewrite it and there's no good substitution in Python, right? And so then you need to end up calling the subprocess, right? And, uh, and so, so you need— there's some aspect of it where it's, it's, it's good.

And maybe we can offer— well, we could also offer this for non-async things, and we could sort of just treat it like a work queue, right? If that helps ease people in. And we could say, hey, here's your regular for loop, now here's your async for loop, now here's your full data flow, right?

And we can sort of step them through the reasons why this is— this is why you might do it this way, this is why you might do it the async way, and this is why you might do it the full data flow way, right? And here's the benefit that you get out of your, you know, each step that you take along that path.

Speaker B15:32

Yeah, that makes sense.

Speaker A15:35

That makes sense? Okay, okay. Um, all right, so let me maybe write that down then.

15:40

5. Docs, demos and tutorials to explain data flows

Speaker A15:40

Okay. Um, should I do flow, uh, improvements? And then I think it becomes, you know, so, uh, here's, uh, standard, um, you know, preprocessing, uh, no loop, uh, loop-based preprocessing, async loop, and then full data flow.

Show how each way works. Each eBay corrected to each way works and described benefits had by moving to the next way.

Speaker B16:45

We could have demos for these as well.

Speaker A16:47

Yeah, demos for these, definitely. Okay. Along with demos. So, yeah, this would be docs and demos.

Speaker B16:57

Yeah.

Speaker A16:57

Docs and demos. Yeah, because, you know, we have the— Um, we have— I think this is the main part that needs to be flushed. Like, we have a lot of good stuff, and you guys have all flushed out most of it, right? And the data flows is something that's not really flushed out yet, right?

And let's see, let's see, uh, tutorials. Yeah, because the data flows is really just like, you know, using locks. Yeah, there's a few things that we've done, but it doesn't explain why, you know. It's sort of just like, do it this way. And then it's like, well, the question is, why the hell would I do it this way? You know, why wouldn't I just write my normal stuff, right?

And so I'm thinking, I think that if we have— yeah, I think, I think, uh, thanks for batting this around with me. I think, yeah, if we explain, you know, how, how do we come— how, how did we arrive at this conclusion that data flows are the way to go by walking people through their different options and showing them, you know, this is what you get.

And then once you get full data flow, then we need to start thinking about, you know, so this gives things like visibility, you know, modularity in terms of the merge, data flow merge. Modularity and maintainability, and then also the swapping out implementations.

18:36

6. Event types, runtime visibility and flow visualization

Speaker A18:36

Yeah, okay. And then soon with the event types, we'll have the, you know, we'll be able to— I've got a guy at my work we're going to work on. I'm going to do some of this event type stuff, and he's doing another little project, and we're going to get together and we're going to demo how you can see, you know, the inputs flowing through the network. Runtime. I'm assuming runtime visibility. Flow visualization.

Okay, um, and then also visualizations, and then also the, uh, you know, flow-based program. Okay, and then we have that guy that Sahil knows. I can't remember his name, who was looking at the UI, Devesh. Okay, cool.

Yeah, I think that, you know, the data flow stuff is just really lacking right now in explanation.

Speaker B19:55

Yeah.

19:55

7. Tuner Development and Task Assignments

Speaker A19:55

Yeah, potential, but no execution right now. So, okay, so you're going to take a look at, um, you know, these existing things that you've been working on. Um, the tuner thing, the tuner thing definitely we'll want to do before, um, before we hit, um, you know, beta, because we'll want to make sure that that's one of those stable APIs. I think, um, I think that should be—

Speaker B20:22

I'll have it done, uh, by the next meeting.

Speaker A20:25

Cool. Okay, yeah, uh, and then what— do you have any ideas? We can probably wrap up here, but do you have any ideas for other tuners that might be good to implement? Because we could create some issues for people.

Speaker B20:41

Um, actually, I had some, but, uh, I can't really—I don't have on top of my head.

Speaker A20:50

Okay.

Speaker B20:50

I can make you a list and, uh, send. Okay.

Speaker A20:55

Yeah, we could always brainstorm next week too. Okay. Or come up with offline and/or. So, yeah, if you come up with any, just post them in Gitter.

Speaker B21:16

Okay. Sure. I actually implemented grid search, right? There's one called GridSearchCV.

Speaker A21:31

Okay.

Speaker B21:31

Which is actually, you know, dividing the data and making partitions and—

Speaker A21:40

Okay.

Speaker B21:40

All that. But it was getting complex for me. So I just— Yeah.

Speaker A21:45

Yeah, I think simple was the right way to go for that first one. I mean, I think it's also like a nice readable amount of code too, which is great for a first implementation.

GridSearchCB.

Okay, so we've got GridSearchCB. All right, let's see. Okay, cool. Sweet. Anything else we should talk about today?

Speaker B22:06

Uh, that's it.

22:08

8. InnerSource Portal, Data Flows and DFFML Deployment

Speaker A22:08

Okay, cool. And then I've got, as far as also data flows go, so I'm hoping I'm doing some stuff. Um, I'm doing some stuff with my— with Intel, and we're trying to implement this. I don't know if you've— I've sort of been quietly pushing some— where were they? Basically this— the— I've changed the— this— there's a software portal demo. I took the software portal demo and I slightly refined it to this InnerSource portal.

We're trying to do this InnerSource stuff in my work, which is basically like applying open source to internal development and sort of like saying everybody within the company should be able to see these things. And then, you know, how does that work, right? And so we need to collect metrics on projects, and then we're going to be looking at, you know, maybe doing some similarity analysis across different projects.

So we were— I pitched that, hey, you know, maybe we can use DFFML for this. So we're gonna— we're trying to use DFFML, and so hopefully this will end up being— this is going to be a lot of data flow work going on here. So I'm hoping that we can use this to, you know, as a— this will probably help me flush out, and I'll need to write more documentation around the data flow stuff, and we'll need to think about, you know, more about how data flows work as we go through this.

And I'm also going to do a thing I need to do by Friday. Actually, I need to do that tonight. Actually, I'll probably need to do that today, but we need to write a— I need to write a tutorial on how we do similar to this continuous deployment of data flows, but how we're going to do the whole scraping service with Kubernetes and thinking about how do you run, how do you like kick off a data flow for each thing to gather some data in a container and stuff and the full deployment.

So this is going to be kind of interesting to see how this goes, and then hopefully we can also sort of prototype how does the model workflow, like how do we do this with models too? So it should be interesting to see, see, hopefully, hopefully we can get this to like a full deployment because I had that— we had that one tool that was using it at first, using DFFML at first, and then now that tool got EOL'd.

So I'm hoping we can get it used in this new InnerSource portal that they're making, and we'll get some, you know, more feedback from users and stuff and more implementation experience here.

Speaker B24:42

Yeah, this sounds great.

Speaker A24:43

Cool. All right.

24:45

9. Intel/oneAPI Use Cases and Collaboration

Speaker B24:45

I don't know. I don't know if you remember this, but we started off on my GSoC project based on something that had to do with the inner guys from Intel.

Speaker A24:58

Oh, yes. Yes. Those use cases.

Speaker B25:01

Yeah.

Speaker A25:02

Yes. You know, that guy, he went on sabbatical, and then I haven't talked to him. So let me go sync with him. That's a good point. So let me go sync with him because we have the use cases now. So let's see. Great. Thank you for reminding me because I had totally forgotten, you know, where that came from. It's been so long. It's been, what, that was like March or something when we started talking about that?

Speaker B25:28

Yeah. Okay.

Speaker A25:29

Use cases. We've completed—

Speaker B25:32

I was just curious the other day: how did they react?

Speaker A25:37

Yeah, yeah, I forgot to go sync with him. I've gotten— I'm sorry, I haven't been very active the past couple of weeks. I've been under a lot of pressure to— there's been a lot of stuff going on within my group, and so I've gotten all over the place. And now I'm sort of starting to regain a little bit of sanity here, so I'm hoping to be able to refocus and get reorganized here.

So I'll go sync with— where were these? They were the oneAPI folks. OneAPI folks on— I can't remember that guy's name. Folks, now that we have use cases, this is to get feedback. So yeah, I'll get some feedback from them. They might tell me. I have no idea because their stuff is very, you know, the oneAPI. API Intel. There, it's more low-level kind of stuff, you know, it's not really user-facing. We're very user-facing, right?

And so, you know, what I told them is this, this is the point of the FFML, is, right, we can make things more high-level. Because me, as somebody who wants to go write a, you know, to use a machine learning model, I don't really necessarily want to go program in data parallel C++, right? You know, I just want to say, "Hey, you know, train me a model and use it."

So I was trying to show them, hey, you know, we've got these models and we can swap out different ones. And so I think your use cases were perfect for what we had talked about at the time. Now, hopefully they're still aligned on that thinking, but you never know, right?

So either way, I'll get some feedback from them and we'll see, you know, we'll sort of, we'll work towards, you know, figuring out how we can get more aligned with them. Because I think that would, you know, that would help us. That would help us get some buy-in from, you know, what I'm hoping is that the tutorials that you did and stuff would help us get a little more buy-in from the Intel developers for things like DAL for Pi and things like that, you know, various Intel-maintained machine learning stuff where they would just implement the DFFML model themselves, you know, and maintain that model themselves, right?

Yeah. Because then they'd see, oh, I don't have to go implement, you know, X, Y, you know, I— my users immediately get to do this, right? And I don't have to— to— yeah, right. There's a lot of stuff they get for free if they just implement the model class, right?

So cool, cool. Thank you for reminding me. That was a big— that was a very important reminder there. Great. All right, well, thank you, Hashim.

28:24

10. Meeting Wrap-up and Next Steps

Speaker B28:24

You too.

Speaker A28:25

Have a good one. Good talking to you today. Bye.

Speaker B28:28

Bye.