Event-driven design patterns to enhance existing applications using Azure Functions - BRK3041

Event-driven design patterns to enhance existing applications using Azure Functions - BRK3041

Show Video

All. Right good, afternoon everyone. Good. Afternoon everyone, thank. You, thank you know. We're its presentation, the theme of the or demos is coffee so, I understand. It's afternoon, third. Day of build really. Excited to be here thank you all for, being here tons of announcement, exciting, things. And. What. We want to do here. Today is talk a little bit you all be hearing about survey less and as your functions, it's, my third build every build we, see more and more momentum and more and more users on server less application, event-driven applications. As your functions, but. We still also see a lot of a lot of companies a lot of you a lot of developers, they're starting, their journey and they. Don't know where to start they have applications, that are already built and, they're. You want to use service, they. Don't know exactly. Sure how so, we want to talk about this imagine. You already, have your applications, anyone, extend it further you, want to add functions, you want to serve less to extend your scenarios that's, probably the best way to start and what we recommend, we don't go recommending but, we write all your code make everything functions, as much as I love functions, we, want you to achieve more, innovation. On your code so. So. Here's the plan of what what, we're. Going to show you today, so we're going to talk about what scenario, that the we're gonna build throughout the talk so. We're going to keep extending, it so that is gonna introduce you to to it. After. That just, to level set we're going to do a brief overview on some of the concepts, that's going to be important, for you to understand, what happens later on and, then we're gonna extend that app and it's four different ways you see there, and. At the end we're gonna leave. You with some stuff you can take away so you can implement, some of these scenarios yourselves, and. Before. We go too far so you know you know why you should listen to us but I'm, I'm, gonna p.m. team lead, the PM team for functions. That. Is well we're both on the same team. Particularly. What, I look at these days is how. Do we bring functions, to more places how, we give more hosting models and more options for you to code it functions. In. Special, a lot of the enterprise scenarios I spend my time on and. For me is also interesting I joined sort. Of the agile world with Microsoft, for a long time but as you're about. Six, years ago and I joined apps service when. Would come to conferences, like build all the conferences and a lot of people they. Believe pass will become a reality the reality it is today so, I feel like we're in functions, of service and service on that same journey it's still somewhat younger, and there's still some, adoption happening, but but. I'm super excited to see where that's gonna take and how that's revolutionizing the industry so. That's. Me. Hi. I'm Corey, I'm also part of the PM team for Azure functions, I've, been in this space platform. As a service, and later functions, as a service since 2012. And one fun fact I was the program manager, for the first iteration of our service, offer so the launch of their consumption plan and.

I'm. Here because I'm, really interested in how we bring joy to your experience, as you adopt. Serverless, technologies. And as you start working with Azure functions, so, I'm always happy to take it ideas, from all of you. To. Navigate this session we, will use a demo app to illustrate, concepts, and. For. The purpose of this session we, are the agency, that is building the web presence, for the contoso coffee shop you're. In Seattle so, from the keynote to the sessions, you have to hear about coffee. And. We. Just really wanted to have an opportunity to extend the portfolio, of this hard-working contoso. Corporation. With a coffee, shop. So. When we started our project we. Inherited. A client. App this is a static client app and the, legacy Web API that is, listing, locations, of all things and, the. Other, entry, points that are critical, for the web presence. Of this business, I just, thumbs that we need to figure out how to implement, and we. Liked the idea of. A, static app from them because we can leverage, server. Less compute, and micro-services, patterns, in the backend and. Also, you probably noticed, we're not the best front-end, engineers, so, this, works for our agency. And. As. We walk through the session we'll look at all the different pieces that we need to compose to deliver, the, end-to-end, architecture. For, this business. Yeah. So how. Many of you are using. Functions. Today already, just so I have an idea okay, how. Many of you use just. Serve listening generals just so see if I get more people somebody and raise your hand so our. Level set just a little bit so you know everyone, can follow along what we have here so one, slide on service. So. As. You know it's called service, there's. Controversy, whether, that term is the right term but what it really means is, once. You are in a hosted service you don't worry about a lot. About the infrastructure, that's under you you're, gonna give, us your application and, then, we'll take care of all of it you don't have to specify the, size, of the machine you need what's, how, many how many cores you need of CPU, how much memory you need or what. Are you scaling it's you just put your application there as events, happen those application, react to events scales, as far and as wide as it needs to process your workload spins. Back down goes all the way down to zero when you're not using we. Do measure how. Many milliseconds. The CPU was running your code so you only pay for when your codes running at a given amount. Of memory that you that, you consume so that's. Service. In less than a minute so the money's a service that's what we're me, as. Your. Functions, again one slides is so on as. Your functions with the diagram and then I'm going to jump into code, as, your, functions is the pro the pro core programming, piece and, where, you have your compute, for service, in Azure, it. Responds, to, number of events HTTP. Of course, and it's a push based event and there are a lot of events that we can pull from such, as key, use and service buzz and event hub, etc. So some it can work on a timer as well most. Those events happen, we run your code and your custom logic when. Within our functions, runtime and you can bring your code in C sharp F sharp JavaScript. Typescript, Python. PowerShell. That I'm gonna talk more about and, we launched last week and, once, it's done it can output we, have this nice concept, of bindings, that a lot of the outputs actually can be made very simple, because the runtime can transform, some of your outputs in richer types or communicate, to external API so. Let's. Function, is a node nutshell, does I know a lot of you are very. Familiar with it and how, that some of these concepts translate to code. So. That's, a simple, as. Simple as possible functions, code that trigger. That, SKU trigger when. You when you see the function name attribute, at the top there that's what determines that this code is a function, the. First, attribute.

You Have in your run method is gonna be your trigger type, in. This case the Q trigger in the string. You see there is the name of your queue and maps. To to, a variable in your code that you can use and then you have your output bindings so you see the out parameter, there and once. This code runs, it will write back to a queue so that's, a simple as possible that. Functions. And those things you're declaring as attributes, you could also declare. Them as a configuration, near function JSON, so, you could have your. Input and output and some, of the other configurations, that happens, at the function level they all gonna go into functions are JSON those, are the main components, so when you say when, we say like your functions all you have to give to us this code. And config that's what we mean could, be c-sharp JavaScript, and then the functions dot JSON so. That's. The. Interim functions and. Then we're going to start building up the scenarios, and and you're. Gonna see some of these concepts come back around. So. The first app extension, example, is focused, on creating, and. Unified. API surface, that. Encompasses. Existing. Assets, that are already in production and, new, business, logic that is implemented, with the help of serverless. In. This. World when, we create an API, facade, we can create that. With the help of API, management which coincidentally was. The session right before this one and. It. Makes, it really easy to. Connect. To server' this concept, what. I like about this in using. API management, is it's, not just a design pattern but, it comes with the benefit, of having real features, behind a product like, the ability to define policies, to, handle are to handle versioning, so. The, more the product can do the less I have to do as a developer and. I. Would like you to notice in the diagrams, here the, business logic can. Be implemented, by. A, mix, of, services. Whether their legacy, whether they're completely, new and so. Here. We're using a legacy Web API and, then, we're adding functions, and if you like you can add connections. To services, such as kubernetes, so, there's no limiting, factor, here and. Since. We're talking about server list we also have. To focus on the specific, tier. Of API management, that, was recently. Announced in preview which is disturb, the list here and. So. With. This year. I, would like to mention that. You get all the benefits of server lists in the sense of you get the. Auto, scale, and high availability and. The paper use pricing, with the generous, free grant and. The. Primary, use cases encompass. The different products in this universe, and the sense of it act as a gateway for, surveillance computing, container-based, microservices. It, provides a simplified. Facade. For. Other. Entities. That exist in our universe such, as the bank sources, and then, it's. Working, really well for. Workloads. That have spiky, traffic. So. When, we go back to our demo app. The. Element, that we're going to explore, in this section is really, adding API management, and the connection, through, the additional, business logic. So. I. Will. Walk, you through. This. Little. Demo here so. This is what. We ended up for, our, coffee shop and what, we started with is just. The ability to, get, locations. Out. Of our legacy Web API, and. Then. We added a connection. To cosmos, db2, Rodger functions, to list out the menu, and then, we. Added about functionality, that, is actually, going to show you in the future sections, how you can communicate, with your team and. We. We have a few different other pieces that we're going to walk through but. Just starting. Back with, the Web API so, the Web API is, getting, locations, and you can see it right here in the API management portal, so, we have a call and we. Were able to go. And retrieve our. Locations, so, you can see the same result here and. Then. You. Might ask how easy is it to import. My functions, into this I don't want to do any work or, at least not anything complicated. So, I would like to walk, you through that workflow, so here we just have an example, function, it's.

Just Doing, an HTTP, trigger and if. I want to import into a, I am all. I have to do is go. And select AP. I am management. Option. Here so you, can see it in the portal and. This. Is embedded. In the experience, so you don't have to break your flow I'm going, to select the, AP, I am instance, that I want to import to and I'm. Going to enable application, insights because this will give you really, interesting, observatory. Capabilities. And now, in terms of API API, entry points we're going to create one for, each of the HTTP. Methods that's supported, by the function, and. Optionally. I, may. Even go, and select a, product. So. Now I kicked off my workflow, to import. My functions, into API, m, and. I will get a message when this is completed, which you can see right here, see. If I can zoom in. So. Now I can, even go in test it out right here in this portal. And. I. Have. A. Test, app that. I can select and. All. I have to do is add a parameter, so. Let's. Say Bill 2019. And. I'm going to make a call and you can see the result, right here. And. It says. Hello. Don't 2019. There. We go and, what. Else can you do that might be really interesting, to have right here in this concept, another, thing that you can do is you can download the. API, definition this, is just a click away it's really as easy as that and. Then. Another feature, that can, be really really useful is. The, observability. Please notice so, as I connect API am I also want to see what, happens, across all the different endpoints that. I'm interacting, with, so, there's, this real interesting, feature the, application. Map that, is going to allow me to explore the cause that I'm making, and not, only that, but. It's going to allow me to have. Really, easy. Diagnostic. Capabilities. So in this case I'm purposely. Generating. An exception, that we'll use throughout the session and if. I want to go and diagnose, that I have the ability right here to say hey I want to see details, and not. Only do I want to see details, but, why don't you point me to the exact exception. And. Hey. We can actually go do exactly that this is the demo exception. So. Um this, is the power of creating. Your unified API surface, with, very little effort. That. The. Demo the diary, did to investigate. The failure some. People take it for granted as, you do more micro services and distributed, apps for. You to find where the bug is in your code between your API layer multiple, services that you're using all disconnected, roni async, it's a real tough task so just, bringing them all together and be able to either. Give you a graphical interface or, a query language that you can go through the logs to find your errors is super, powerful in something that I haven't, seen other, products do so. Okay. All, right. Okay. So, so. Now that's so extended, we extended with wait API am created, a single facade. Single, surface, for. All that functionality didn't, exist on, our coffee shop for. Which dari and I have been hired for the day to be developers, for okay, so. This. This. Application. And it's common, as you have a presence on the cloud typically. Have tons of other resources, as well your application, if it's complex, it's not a server less it can be all sorts of other components, or deploy to Azure so. What we see more and more is as, you as you add resource to Azure you. Need to have a way specially on caesarian hundreds, of them each, resources. A lifecycle of its own you're, going to deploy your resources and. Again they could be VMs. They can be storage, sequel, you name it but, you deploy them then. You go to that lifecycle, you have to secure that endpoints, according to your rules you're gonna have to do your disaster recovery or, backup to a different region you, need to monitor to react when things go wrong then. You might need to apply different configurations. Or policy, that's required by your organization. So that's, a very common like it's that it's been changing a little bit if some of you work as ITES, or you're. An SRE the. Role has been changing a little bit because now we have to monitor all these cloud resources, and, you.

Have To take care of it and there are there are hundreds of them so you need to get to a real cloud, automation, the. Good thing there is a lot of these things are event-driven. By nature easier they happen on a schedule, you have to do something every day at 6 p.m. or, because an event happened like an application reach, the limit of failure that someone has to react so so. For those functions. And event-driven, architectures, fits perfectly, because, you can have that event trigger, code to run however. One gap we had function as a platform is a lot of this automation it's, written in PowerShell so. Just. Last week we start the preview of partial, core functions, allows for it implements such snares with Azure functions, now so. Going. Back to our demo. What. We we, coded here one part of the functionality. They about functionality. I'm going to show we. It's. Failure and we have to investigate and imagine, you want to automate when. Such failures happen to trigger a script that will notify you somehow. So. I'm switch to my machine so you can start seeing this thing in action. Okay. So. I'm here Saint same, UI and, again our dev team doesn't have a designer so that's why it looks like this looks. Interesting, and then, when I click the. About is generating, at five hundred so imagine that any of that website could, generate an event some. Some error that our one, how would you do that, so. I'm. On the edge of portal now and I have my resources deployed, in resource, groups and this nice functionality, the resource groups have is the ability for you to configure alerts right. And those, alerts once you configure you get this dashboard and, you can tell what severity, that alert is how we can react all, the kinds of alerts and how. How. They happen when they happen you can drill in, the. Way you configure, an alert. You. Can. Create. An event in a condition, for it in this one that I created. Was if, any error in, the 500, range happens, it's greater than zero even if a single one happened, do. React to it and then you can create an action group of which actions, you want to take when these things happen so. Here you, manage the Asha action, groups what, I configure, was a web hook you can configure it to send an email to you in that. Web hope it's. Calling to an end point and this endpoint here is just. An azure, function, st.. Teens notification, alert right. We tell temptation, code so. So. Now I can have an HTTP, function, that listens, to that endpoint that can react to it so, let's show, you that how that function, looks like so. This is the the, powershell function. Now on, the azure portal, and in. That. That, function is pretty simple, most. Of it is Stix takes the input parameter, configure. How to call, and I'll show that in a, minute how. To go into teams because, that's how I have my notification, to be delivered via teams because teams can you know alert my phone it can alert a group of people and then. I configure, the actual alert and the text that's going to be fired, that's. Essentially. What function does at the end of it once you prepare all the data you invoke that endpoint. It's. Just to show how that's configured the. Team's webhook. It's. Configured, here so it's, gonna call a. Graph. API that's gonna go to teams so. If, I go to teams because I clicked on that about before, and generate an event you. See that alert alert, has been fired so that's how the alert would look like and again this could pop, on your own, phone or anywhere. You want so that's a very simple example PowerShell, running in practice, there. Is. There's. A lot more you can do one. Thing while I'm here that I want to show is. We're. Gonna we, have this service library, that shows a lot of the common functions code so if you don't want to start from scratch I know that reporter, will give you some templates that start your code but, he found some solutions. That are ready to be deployed you. Can go here and you find that solution a bunch of languages because we have just, launched PowerShell, we have one, script so far but for, JavaScript you have dozens of them and then you could find some for PowerShell as well here so so. If you want to get started, ready-made, example, good server let's library now. Let's talk about. Some other. Other. Scenarios, in which. Automation. In PowerShell can be useful. So. That's what I implemented, just something that we ate reacts. The about but here's. Some other examples, and some other ways you can hook up those. Event based automation, so, you, can have tons of things that happen during deployment, time they're listed there or you want to operate you. Can do a pub, sub model and use event grid and then, you can have.

Multiple. Publishers. Or remote post subscribers, to that that can react to it so allows you to connect anything. To anything else so you can have the computer functions, for. Any, resource you want and trigger from you, can have as your monitors the one I showed so, alerts could trigger your application, logic, apps can call into functions as well or, you can have your DevOps. Pipeline actually call into functions so tons. Of different ways you. Can implement your automation. So, one that I just want to show here, is the problem. The most common one people ask is to start and stop their VMs because it cuts down costs, or because, they don't want those VMs running all, the time so. Here is example, two how to start a VM and this is as simple as it. Gets and gets even simpler, because we implemented, this functionality, called manage dependencies, so a lot of the azure a stick things that will you'd need to bring with your code we, already pre-loaded for, you on our deployed. Functions. Runtime that runs PowerShell, so. In the authentication, as well so you see that this is not authenticated, with Azure or it's, bringing any other dependencies, all, you have to do is this piece of code and this would run and start your VM similarly. You could do a stop VM, as, well, so have, those two examples again they're on the service, library from looking. To them when. You get back home or on the airplane and. Yeah, now we're going to continue the third third accessibility. Scenario, so. With the third extensibility, scenario. We're going to talk about, workflow. Orchestration, with durable functions, and. I. Would. Like you to keep in mind this is an advanced, feature for, writing long-running orchestration. It, can help help you solve a range, of, complex, and stateful, coding problems in the surveillance phase. Durable. Functions, is implemented. As. A, natural functions it's extension, and this built, on the, open-source, durable, task framework, and. What. That means it's. Durable. Functions, just like the rest of functions. It's. Open source and it, also has a surveillance, model of hosting, where you pay only for what you use. The. Durable, functions is actually, not that different from other functions, except, for three, very specific concepts. The. Concepts, are one. Of them Orchestrator. And the, orchestrator. Describes. How actions, are executed, and the, order, in which they are executed. The. Second. One is the activity functions. And the, activity, functions, just represent, the unit of work and. This. Is where the, actions, that we request, are implemented. The, client, functions, they, create, new, instances, of, an orchestration. So. These are just the three concepts that are specific, here the. Orchestrator. Is, the. One that stores. Execution. State and then, replace, that state, - basically. We. Establish. That your ability, every. Single, time. And. Just. Looking. At the concepts, here so. We have an. Example of, the client function, here and the, first thing that we have is an Orchestrator, client, binding, and that. Is the one that can, start, and stop the. Orchestrator, instances, and then, it can get. Instant. Status and send event notifications. And. Here. You can see the transition to the orchestrator, function, so, if we look at what that looks like this, is our Orchestrator right here and then. The orchestrator, is the one that calls the activity, functions. So. Just. To give you an idea of how, this actually happens, in practice. We. Can look at, the. Workflow. That, we use for, a, in. Example, registration and the. First thing that we do is we, have the client, who.

Is, Waking. Up the, orchestrator, by placing. An item, on under, control, queue. So. That has, the effect of waking, up the orchestrator, who notice there's work to do and it, goes and that replace, the state to establish where, we are and we notice that we haven't actually completed. That work so. At this point. The. Orchestrator, can place an item on a work item queue and. It's. Asked, to await, so, it can now go to sleep, and. The. Activity. Function can pick up the. Item from the work item queue and, it. Can execute, what we asked it to execute, it, places. An item, under control queue to let the workers traitor there's something to look at and then. The orchestrator, will, go it, will replay, the state noticed, Agnes now we have a result, and return. So. Going back to, icon, toaster coffee shop we. Also. Extended. Our app will. Be ability, to do. Order approvals. So let's say I'm the barista, and I need to order more coffee because, haters. Build and there's so many people in town and so. I need, to request, approval. For. My. Coffee and so, we implemented that with the durable, work flow pattern, and. Just. Going to illustrate, that. Let's. Go back to our little application, here. And. The. Way that I'm going to. Place. The approval. Request is by, saying I want to order, a certain coffee blend, and then. I'm, going to submit. A request. Which. Shows up as a text, message and, I'm sure you all can see yet, we're. All close enough and that, text, message is going to be the one that, allows me to approve. The order so I'll do it right here and. I. Prove, to all of you she really proved that it was not yes, and we really banked on the fact that you can see the phone screen from there but, you know what you can see is that, we have a change of status here. So. If we zoom in you can see that we did change the status and this now shows approved. So. How did we do it I want. To give. You an opportunity to have a look at the client code first so, we had a client app, page, that, showed you how, we are requesting, the approval, and, all. That, is it's basically calling. Into. This. URL, for the orchestrator, here it's, actually. Abstracted. It, or today, Jordao. Task framework, underneath, but. This. Is what it looks like from the client perspective. Now. Just, to go to the other side of the client experience and, then we'll move back to the back end of durable, functions, the, other side of the client experience that you just witnessed here, is how do I send the approval, and this. Again is a call from the client app and the, way that I, implement. That is by raising an. Event so, this, is. The. Code right here to raise the SMS, challenge response event. Switching. Back to the backend. Here. We have the orchestrator, code so. I will. Point out that, as we are, in this context, we. Have the ability, to, call. The. Activity function, right here and this is the one where we send the phone number and we request for the. SMS, to be sent and, for. This particular, demo we. Set. A timeout. Of 90. Seconds, but. The. Good. Thing to know is that this, is not constrained. 90. Seconds, is just an example timeout, the power of, the, durable, functions. Is that you can really have a long-running. Operations. As you need and. Then. The. Other thing I would like to point out is that. Here. The. Orchestrator. Will actually, go to sleep while it's waiting for an async operation, to be completed, so that addresses, some of the questions, in terms, of hey do I get charged for everything, and, you only get charged when this is running. And. Just. A little. Note on how a state is stored so we store that in a. Table. Storage. So I'm. Just, one showing. You an, example, that we won't go through but it proves that the different stages of execution, are. Going. Through. So. Back to the site. Just. Do I like what. The reason the approval workflow is interesting, is because the the time that it would take for a human to react that's not, predictable but, we, do know your functions reruns for over ten minutes of regular functions will shut it down right so. So, this type of pattern, which. Is just not possible with just regular functions, you'd be limited to those ten minutes unless you deploy functions is dedicated, but you found that serverless way to do so you, need something like durable, so so that's that's why. Durable is important in this scenario so. For, this particular, session we only show you the human interaction, pattern with durable functions. However. There. Are a lot of other patterns that, you can implement and these are a few of the other examples.

You, Can do, functions. Changing, where, you, take the output of a function and use it as the input to another function, you. Can also. Do the. Fan-in and fan-out pattern. Where, you can use, an event to. Paralyze. Execution, into a bunch of functions and the power of this particular, pattern is that you can do aggregation, at the end and, then. The, the, API. Pattern. With async. HTTP. API is this is something where you may have a long-running, execution. And you may want to let a. Client, out here, know what's going on and this is actually how our later example was implemented, as well we have a way to, go inquiry, established, through the HTTP. 202 pattern and. Then. Monitoring. On an external endpoint, with the another one and. We, have a session, coming up right after that, is really focused. And a deep dive on terrible functions. And. It's going, to go into the new features for stateful, entities as well so. I would totally recommend that if you have the time. There. Are a few, gotchas with. This. Workflow, so the orchestrator, has a couple, of requirements. The. First one is that your controller code must be deterministic. Because. Every operation, has to have the same result, it. Will be executed. Once and then we will replay, the same result, so. What. You don't want to do is don't use random numbers don't generate, goo it don't. Do IO directly. In the orchestrator. The. Other one is, don't. Write infinite, loops because, what happens, is we, have an increasingly, long history, that we need to relate through and that, means that your execution, time might increase as well. So. Going back to, the life section. Of our presentation and I love that durable functions, things I think it's still we. Love. Talking about it because opens, up so many possibilities just. A little detail - oh like like. When you do a task, and you can wait and you can do when all it's just so so powerful like so, if, you haven't tried try it out now. Less. We, won't extend scenarios with with, machine learning how, many work with ml some way or another. So. A few of you so it's good because I have a just. A few. Context. Here's just a few slides to see, what why, ml and why why you should care and how you can implement it so so. Typical. Process. Of machine learning, is. Divided, into model, trainee and model deployment, so. In very basics, typically. What you you have is a large. Data set in a raw format, that. You want to turn that the model you want to learn from those examples but. This data set to have dirty data is gonna be incomplete not going to be in a standard format, so you need to pre-process that data this, is a iterative, process, until you get the data in the state you need remove, duplicates, and so on so forth once you have that the right way you're. Gonna pick the tons of different algorithms, in ml like what is a regression, I bathe you. Name it and you can pick. The right algorithm. For the job you're trying to achieve if it's if, it's something related to images, you might want to pick neural networks is really to text you might have pick something different so you, pick the right algorithm, once. You pick that you typically reserved, some of the data set to be your golden set to evaluate that model you're going to get a precision recall number, back to, decide which model fits. Your needs in terms of what's, your criteria for it to go to production once you find that model, you actually deploy, it and using your application a lot, of your developers, you're probably on the further end of it is where. You typically live, which is on the application world. So. So. Now the. Way the way this is typically done is you have a data scientist, and here's the one. Responsible. For model, training a lot, of his day job is on the data set and cleaning up finding it right data and. Then just, like I showed the algorithm, that you want to use and then, how often do they need to retrain, to account for new examples, there's happening, on a particular, scenario the. App developer, typically. Is left with the job of hey, the model does exist, how, do I put this in production like what is what is the right model do I need to use a VM do and you'd use a pass service. How, all you a load this up in memory do I break it down separate. Do a processing. Parallel, that process linearly, how. Do i scale in case this model is something that's going to have, thousands. Of events, at the same time how you're prepared to handle such load and when things fail how do i monitor it so.

If You could think if you're noticing a pattern and all these questions what solves all these questions is this service, really, helps with all of these questions so once you apply service. Or function as a service now. You, can take advantage of all those things I talked before about service, and then, have. This thing ready to scale but, let me show how that works actually functions, so, when you train a model typically. Get an asset out of it typically the mod is in a binary format. And. You have a script that script knows how to use that model, very. Commonly is going to be Python, what's gonna be that scoring script and. On your Python code you might have some dependencies, it's gonna bring some libraries, helper, libraries, or some other libraries that you might want to use once. You have all that you can deploy it as a functions also. Something we didn't, have before we start with. Pythons. On public preview, and. Let's. Say your functions, in HTTP, trigger function you, have your input data using, HTTP trigger to use that model so so. That's typically, how it works but I want to actually show, you so so. Yeah I didn't add it to the main app this. Was done by our research. And innovation, team so it's a little different because ml, we're, trying to find a fun scenario, it's a little silly so bear with me, I know, all. Of you have this question how to order enough coffee for your development teams so we thought this was super relevant to this ah yes. So. And there is again. The point the presentation, is not as much model-train II. Don't. Intend, to turn your own data scientists, in in a talk but so. There's a bunch of data sets already ready for you iago has one of those so. You, found this fascinating data, set that do. Analyze it's amazing how much time people spend on this how. Much how, much programmers, drink coffee and they analyze the patterns they. Were able to map coding, hours to the amount of cup, cups. Of coffee per, day what time of the day they drink it what, type of coffee etc so, you. Can in this this gives you so many possibilities but, ok so. What we did with, with all of this we created. One. One, app here, and this is the front end that goes in a given github, repository. Looks. Like at the amount of commits. Assume. A given number of hours per commit and then, we estimate how much how many more cups, of coffee you need to keep your team running for next two days again. Super. Useful I'll share the code because I know you need it but. So. But but let's show the code now out of the fun part like that's the part that that does matter how do how, do you leverage those things on as your functions right, so.

Here's Here's fightin running in the S code measure functions, again normal. Vs code you would get you're a little bit loco, debugging, you get - of functions extension, all that goodness and it. Is, a function like. Any other function, this is a HTTP. Function. That. Loads a model like I said the modal models, are binary format it's here but you can see the content of it of course but. You load it up in your code, and. The. Codes actually pretty simple what what's. Gonna do is gonna get based. On the amount of commits is gonna get a number of hours that that, particular repository. Had. Coded and then send. That to, the model to predict so, that's the parts gonna predict the amount of coffee cups you need for the next 48 hours and then, sends the response back to our web. Ten and. This, is very native to Python as well so things like the way you bring dependencies. Is requirements, of txt, if you're not familiar with Python that's how you do it similar. How we'd have, nougat. For dotnet or, NPM, for for JavaScript, and you'd, bring all sorts of dependencies. You need let's say the SyFy one that helps you with the math libraries. And statistical, libraries for instance so, so. That's your code you can from here you can deploy to your asha function, i'm gonna show. This code Ronnie so if, I go here and this. Is all the functions of repository, I didn't, want to pick any of your repository do you want to you guys to make any assumptions about your teams but and, we have the functions repository. Which. Is essentially, a metal repository. That, only has announcements. Doesn't have means check-ins so 1. Cups enough probably, that's for the PMT ok. And then the host is which there are functions runtime is. Some. 18 cups before, working hard and then, our tools. 59. Cups okay we're doing a lot of work in our tooling it seems like but this. Calls the backend that as your functions that is. Running the call to do that prediction so cause exactly, this model, predict line of code so. Super easy to for you to just. Host. And take, advantage of service, with. Python in machine. Learning scenarios. Here, but. There's machine. Learning actually gets, a little bit more more more complicated. So this. Is a very simple scenario but not always simple so, some of them what, we've noticed is some of these models, they are a beast, in terms of memory like a normal, function running consumptions, you have only up to 1.5, gigabytes, of memory so. A lot of times you need more than that so, if you take advantage of things, like, like. The premium plan now we can go up to 14, gigabytes of memory for, instance some. Of those executions. Actually take longer than the ten minutes execution, that's where we'd I explained the durable functions will come in and will be super handy. Some. Of the even, the inference but definitely model training we require hardware, that you don't normally have on, the azure function service because, you have premium consumption, but if you want GPU. FPGA. And, accelerated. Hardware then, what you can do and if some of you have seen we, announce functions can run kubernetes, we announce the scalar for kubernetes as well so. You could provision. This type of hardware. To run on your kubernetes cluster and, deploy, your functions, to it so it can take advantage of the underlying hardware again. A runtimes the same that, runs across wherever. You deploy it so, the functions experience, is going to be exactly like the one I just showed. No. Report is interesting, and there's a lot of talk about is I showed, how to bring a, Python. Code with config, and you. Can deploy all of that but. A lot, of environments now you're developing two containers the way you're packaging your application, is in a container format, and you want to host a container so. We do we do offer that some people might. Not know but we, have an azure functions, for Linux so, you can bring your container your container will include, that as your functions runtime, we, include your code your dependencies, you deploy to us and we'll, take care of it of run your functions into it but. Things on the roadmap is how to scale that service, based on events. In. The future. The. Other part sometimes some of this data set and it's very common some industries, is that the data set cannot, leave on-premises, the the. Policy, for, whatever reason the company want to keep though that, data on pram on your own network so. For, that you need to turn the linear functions, running on the cloud to be able to access that that network so for, that the premium plan gives you a bunch of other options that you can create.

Access. Resources, on a V net and you, could do that communication. Both ways but, some, other times you also want your code that process, that data to, be fully isolated no, HTTP. Endpoint exposed. So, for, that you can have for isolation by using the app service environment, and run your functions app service environment, so, ton. Of different, options again, none, of these limitations, are particular, to Python our ml it's just functions in general we, always like to say try. Service, that, should be a great way to subs 90%, cases but it's some of the other cases you will need one of these options at the bottom that, to give you power to overcome, some of these limits. That you might face. So. If you take aways for this session. The. First one we. Have a lot of announcements. Around Asha functions. Either. A builder and proximity to build and, we know that you get so much information so, just. Go. Look at the Asha blog and, you'll find a lot of our. Announcements. With these. Verses for further learning and, links. To our dogs and everything that you need to get started that. Includes. A broad range of announcements. From, running. Functions, and kubernetes, with, serverless scale to. New. Development. Language improvements, and announcement. So the. Announcement of powershell core and then, improvements, for our, deck a dotnet support, with dependency, injection, improvements. For a darknet lang non dotnet, language experience, with extension, bundles, and then. Going. Into developer, experience with improved agile devops. Support. And a. Bunch of others that, you can definitely go, and. Look. At as, part of our build announcements. The. Other thing that I wanted. To make sure we, mention here, is that. Getting. Started is really easy, if you don't want, to write your own code you can get started with samples, that are available in the surveillance community, library, and also. You. Can contribute, to that and you, can make, sure that the world gets to benefit, from your code if. You submit it as a sample. Just. To recap. What, we learned today we. Have a few design patterns, that we covered and. Those, winds cover. Creating. Unified, API services. Surfaces. Event-driven. Automation. The. Long-running. Orchestration. And machine. Learning with, Azure functions, but these are just examples we. Know that you have business logic that's already in production and, you, don't need to rewrite that you can always extend it and leverage existing assets. And, really. Enhance their value with serverless technologies. Also. We. Know that surveillance. Like a writer said is. Appropriate. For maybe the majority of cases but, there will be cases where you need to use something else so, don't be afraid to break the server this class and create, composed, solutions, they really work. If. You, want to get started there, are a lot of resources, to get started with Azure functions, and assured comm, functions, and also. You. Can go, to our, github repos, you, got, introduced, to them in terms of coffee cups but, they're real and, they. Really. Allow, you to participate in our community, whether is just a signal, an issue and, tell us we need to fix something whether. They're. Participating. In the discussion, or whether. You want to submit PRS. To improve our product, any, and all of those are always welcome. Yeah. And we're pretty we're pretty active on I think, we're pretty active like on Twitter too from the reach out to us also, realize. We have time in the end I know some of these announcements, we didn't we. Didn't cover some, of them at all so if you have questions on any of them di. Integration. With DevOps, any. Of the stuff you've seen there we're, happy to answer either here or online later or at the booth as, well. There. Are few more things coming in and, a few more things coming, we. Have a couple more sessions that are coming up this afternoon, so we wanted to make sure you're aware and, then. The, recordings. For the other sessions, that are covering surrealist concepts. We. Wanted to say thank you so much we know you have a large. Choice and a lot of options and you chose to learn the best herbalist, in this session so thank you and. We. Always, appreciate, feedback and, we, appreciate. That a lot of resources, that you can use to continue your learning. Thank. You everyone.

2019-05-11 00:02

Show Video


Real voice?

I'm function.

Nice demo, I appreciate presentations that display demo apps. It gives me the opportunity to remake the app for my personal learning/use.

Other news