<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ruwan Lambrichts on Medium]]></title>
        <description><![CDATA[Stories by Ruwan Lambrichts on Medium]]></description>
        <link>https://medium.com/@ruwan.lambrichts?source=rss-ae408b6f4ebc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*t8ltORI_Cs6f6ahIq3txtQ.jpeg</url>
            <title>Stories by Ruwan Lambrichts on Medium</title>
            <link>https://medium.com/@ruwan.lambrichts?source=rss-ae408b6f4ebc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 15:00:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ruwan.lambrichts/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Our takeaways and sessions to rewatch from Beam Summit 2022]]></title>
            <link>https://medium.com/ml6team/our-takeaways-and-sessions-to-rewatch-from-beam-summit-2022-fecee83d892e?source=rss-ae408b6f4ebc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fecee83d892e</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[google-cloud-dataflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[apache-beam]]></category>
            <dc:creator><![CDATA[Ruwan Lambrichts]]></dc:creator>
            <pubDate>Fri, 26 Aug 2022 07:31:53 GMT</pubDate>
            <atom:updated>2022-08-26T07:31:53.898Z</atom:updated>
            <content:encoded><![CDATA[<p>Last week, the Apache Beam youtube channel uploaded all the recorded sessions from the Beam Summit that took place in July 2022, which our ML engineer Konstantin attended to give a talk as well. There is a lot of interesting content out there, maybe even too much! So, we’ll try to make your lives easier by sharing our overall thoughts &amp; takeways on the summit and why we’re excited about Beam’s future. In addition, we’ll share some interesting sessions we think are definitely worth checking out in more detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xfxjjd9JxH1t1Ubf" /></figure><h3>Main takeaways</h3><p>Although Beam is part of the open source community, Google is one the driving forces behind Beam as it’s used at multiple places within the company (with the Dataflow Runner). <a href="https://youtu.be/Z6NUEr3dVEs">The keynote talk</a> outlined their efforts for Beam are focused on three axes: growing Beam, learning Beam, and contributing to Beam. We’re excited to see Beam growing even more and gaining more adoption.</p><p>Among all the case-studies, deep-dives and general trends talks featured on the summit, our take-aways can be divided into three main themes:</p><ol><li>Machine Learning &amp; Beam: MLInference, MLOps pipelines, ML Design Patterns with Beam, lots of ML use cases, …</li><li>Expanding Beam: Beam SQL, Beam DataFrame API, multi-language pipelines, new SDKs, Ray Beam Runner Project, …</li><li>Beam in production: cost-efficiency, performance testing, error handling, dataflow templates, …</li></ol><p>Of course, this list is not exhaustive and there’s more, but the bulk of the sessions can be placed under one of these themes. In the next section, we’ll go over our selected talks of each category worth checking out in more detail.</p><h3>Highlighted Sessions</h3><h4>RunInference: Machine Learning Inference in Beam</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*aVcZgNO8929DI02rbl3neQ.png" /><figcaption>ML Inference in Beam pipelines (<a href="https://docs.google.com/presentation/d/1U8k4ersWzq5Nd9g2f8P31Xe2FR343OCIQ9mhj7evFcY/edit#slide=id.g13cf554d54e_0_6">source</a>)</figcaption></figure><p>Starting from Beam 2.40, Machine Learning has gotten a big upgrade in the Apache Beam landscape. In general, there are 2 ways of doing inference in your pipelines. Either you expose your model as an external service via REST or RPC and call it from your pipeline, or you load your model on your working and do local inference.</p><p>Before, if you wanted to do the latter, you had to write your own custom DoFn, or use the RunInference utility from the tfx_bxl package (which is only for TensorFlow models). Starting from Beam 2.40, you can now use the built-in RunInference PTransform. What this means, is that there is now a clean and simple unified interface across all internal implementations, which takes care of a lot of boilerplate stuff like dynamic batching, key forwarding, exposing standard metrics, …. Yay!</p><h4>Scaling up pandas with the Beam DataFrame API</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*-bJqUkxc30J14Hmn" /><figcaption>The previous beam-pandas dilemma (<a href="https://docs.google.com/presentation/d/1x9z0aMlm0mNMoa1Z9YJFdD_a_gVF2w4sG44ou8gR4xw/edit#slide=id.g13ae38ba074_0_234">source</a>)</figcaption></figure><p>As Machine Learning specialists, the pandas library is one of our go-to tools to inspect, analyze, and transform structured data. The Beam community also recognized the power of pandas as it has an efficient implementation (thanks to its columnar memory layout and C implementation), a declarative and concise API, and it’s a framework almost all (if not all) Python developers know. However, ML also involves large amounts of data, which can sometimes become a problem for pandas, which is in-memory only. As a result, they came up with a way to combine the best of both worlds by making a pandas-compatible API in Beam. (Note: there are also libraries out there that aim to address this problem, such as Dask or Polars)</p><p>After a glimpse of the Beam DataFrame API and how to use it, you’ll get a better understanding of how it works behind the scenes such as the idea of the proxy object and the expression metadata. Additionally, you’ll gain a deeper understanding on both Beam and pandas. For example, you might be surprised to learn that all pandas dataframes have an index and that many operations actually implicitly use it!</p><h4>Beam in Production: Working with DataFlow Flex templates and Cloud Build</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nxm6tJ-m3XUN0Wmu.jpg" /><figcaption>Sharing a Dataflow pipeline with Flex Templates (<a href="https://cloud.google.com/blog/products/data-analytics/create-templates-from-any-dataflow-pipeline">source</a>)</figcaption></figure><p>Beam is incredibly powerful, but its value is only unlocked when you start using it in production. If you are eager to learn how you can reliably update your pipelines and deploy them across environments, this talk is for you. While it will probably not answer all the questions you might have, it is a good starting point to start digging deeper depending on your exact needs for running CI/CD for Beam pipelines.</p><p>The first question you might have is how you can test your Beam pipelines. Luckily, Beam provides the TestPipeline class and utility functions to make your life easier. This enables you to test whether the output matches the expected outcome in Beam paradigm. In addition, you’ll also see how you can test streaming pipelines!</p><p>The second step is to deploy your pipelines in a reliable manner. Flex Templates are a great way to achieving this as staging and execution are separate steps. This also allows non-technical users to launch pipelines (from Cloud Console for example).</p><h3>Bonus talks</h3><h4>Where is Beam leading Data Processing now?</h4><p>A great talk by Kenn Knowles takes one step back to look at the bigger picture and the landscape surrounding Beam. This talk offers some great insights in where Beam came from, which paradigm shifts it enabled, and which directions data processing could evolve into in the future. A must-watch to learn more about the data processing concepts surrounding Beam.</p><h4>Online clustering and semantic enrichment of textual data with Apache Beam</h4><p>Want to know how we have used Beam in one of our projects? This session is for you! Here, our very own Konstantin shares insights with regards to using Beam efficiently as an orchestrator for Machine Learning services to solve real-world problems, such as real-time semantic enrichment and online clustering of text content. We love this talk, but we might be a bit biased here of course ;)</p><h3>Want more?</h3><p>If you want to have a look for any other recordings that could be interesting to you, you can find the full playlist <a href="https://www.youtube.com/playlist?list=PL4dEBWmGSIU9OkXQU2OAXmITPLhiMSPRp">here</a>.</p><p>Interested in more Beam content? There is the Ray Summit on which the <a href="https://www.anyscale.com/ray-summit-2022/agenda/sessions/200">Ray Beam Runner Project for unified batch, streaming, and ML</a> is presented in more detail. Alternatively, if you’re more interested in stream processing, there’s the Pulsar Summit with a talk on “<a href="https://pulsar-summit.org/event/san-francisco-2022/schedule">Beam + Pulsar: Powerful Streaming Processing at Scale</a>”.</p><p>There’s also <a href="https://www.gcppodcast.com/post/episode-299-apache-beam-with-kenneth-knowles-and-pablo-estrada/">GCP Podcast #299</a> with Kenn Knowles and Pablo Estrada about Beam, <a href="https://www.gcppodcast.com/post/episode-299-apache-beam-with-kenneth-knowles-and-pablo-estrada/#:~:text=PABLO%3A%20One,was%20super%20cool.">featuring </a>one of the <a href="https://www.ml6.eu/knowhow/sports-intelligence-engine">use cases we have done in the past at ML6</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fecee83d892e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ml6team/our-takeaways-and-sessions-to-rewatch-from-beam-summit-2022-fecee83d892e">Our takeaways and sessions to rewatch from Beam Summit 2022</a> was originally published in <a href="https://medium.com/ml6team">ML6team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why we decided to help maintain connexion]]></title>
            <link>https://medium.com/ml6team/why-we-decided-to-help-maintain-connexion-c9f449877083?source=rss-ae408b6f4ebc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9f449877083</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[connexion]]></category>
            <dc:creator><![CDATA[Ruwan Lambrichts]]></dc:creator>
            <pubDate>Thu, 20 Jan 2022 09:51:00 GMT</pubDate>
            <atom:updated>2022-01-20T09:51:00.444Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is connexion?</h3><p>First things first, connexion is an API-first framework developed by Zalando. While it was originally built on top of Flask, connexion was later on extended to work with other (async) web frameworks such as aiohttp.</p><p>With connexion, you first write your API contract, using the Swagger/OpenAPI standard. Then, the endpoints you defined will be mapped to your Python view functions, ensuring that your python code does what your API contract says it does.</p><p>This makes it rather unique in the landscape of Python web frameworks, as most other tools start from your code instead of the other way around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*YFM_prAm9KkqK_Ur" /><figcaption>Source: <a href="https://www.slideshare.net/try_except_/api-first-with-connexion-pyconweb-2018">https://www.slideshare.net/try_except_/api-first-with-connexion-pyconweb-2018</a></figcaption></figure><h3>What is API-first?</h3><p>API-first (or contract-first) means that developing your REST API begins outside of your (Python) code. You first define your API’s behaviour using a standard specification language (Swagger/OpenAPI in this case). You can then consult with stakeholders and your API consumers before you start the actual implementation.</p><p>This contrasts with the ‘code-first’ approach (also called ‘implementation-first’), where you first think about and write the implementation. Then, you can generate the documentation of your API using the OpenAPI standard.</p><h4>Why we prefer API-first</h4><p>At ML6, we like using the API-first approach to work together with our clients. This enables us to focus on the business problem we are trying to solve without mixing in implementation details: there is clear separation of definition (“what”) and implementation (“how”). Moreover, multiple teams (e.g. frontend &amp; backend teams) can work in parallel based on the contract that was agreed upon. With code-first, one party has to wait until the other party has completed the implementation. For example, the frontend team can easily mock the backend using the API specification.</p><p>In addition, most other frameworks use decorators to map your Python functions to the endpoints, which may clutter your code by mixing REST “logic” with your application logic in the same file. In connexion, you only write your application logic, and connexion will link your function to the corresponding endpoint from your API definition.</p><p>For more detailed information on the benefits of adopting an API-first approach, you can read the excellent <a href="https://opensource.zalando.com/restful-api-guidelines/#api-first">RESTful API guidelines from Zalando</a> or <a href="https://cloud.google.com/blog/products/api-management/api-management-for-integration">this blogpost by Google</a>.</p><p>Another benefit of API-first is that this integrates nicely with the workflow to deploy your API to Google Cloud Platform, for tools such as Google Cloud Endpoints and Google Cloud API Gateway, which use the OpenAPI specification. You can then host the documentation of your API with the Endpoints Developer Portal (using different IAM and security than for your API itself).</p><p>This also applies to other cloud providers. For example, you can also use it to deploy your API to <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html">Amazon API Gateway</a> or to <a href="https://docs.microsoft.com/en-us/azure/api-management/import-api-from-oas">Azure API Management</a>. When using a code-first approach, you have to run your application to extract the API contract, before you are able to deploy it, which can be a hassle and potentially cause issues. For example, the generated specification doesn’t exactly match how you intended it, or your application requiring a database connection, which you then have to mock. By adopting an API-first framework, the API contract becomes the ‘central truth’ which is more robust and secure as it becomes more clear about what the API should do and what it does not do, and how the implemention potentially deviates from that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/0*hxXgBhxA1-UUlq4s.png" /><figcaption>OpenAPI specification (fka Swagger). Source: <a href="https://blog.readme.com/how-to-generate-openapi-descriptions/">https://blog.readme.com/how-to-generate-openapi-descriptions/</a></figcaption></figure><h3>How does it compare to FastAPI?</h3><p>Let’s take a closer look at how connexion is different by comparing it with a popular, fast-rising web framework: FastAPI. Our goal is not to argue one is necessarily better than the other, rather, we are trying to identify the advantages and disadvantages of each framework’s approach.</p><h4>Difference in vision: API-first vs code-first</h4><p>The functional differences between connexion and FastAPI come from the difference in “vision”: connexion is API-first while FastAPI is code-first.</p><p><strong>Connexion</strong></p><ul><li>API-first</li><li>Determine API contract (with other parties) and write code that adheres to it</li><li>Use jsonschema for validation (OpenAPI is based upon jsonschema)</li><li>Deploy easily to GCP using OpenAPI contract</li></ul><p><strong>FastAPI</strong></p><ul><li>code-first</li><li>Write your own Python code first and share with other parties how they can consume your API using OpenAPI standard</li><li>Use pydantic for validation purposes* (which also focuses on “making it available in your Python code as Python objects”)</li><li>Possible to deploy to GCP with workaround (i.e. extract the OpenAPI document by running &amp; mocking your API itself — which might lead to inconsistencies and troubles)</li></ul><blockquote>*Note: pydantic’s purpose is parsing data into Python, this is <strong>not </strong>the same as data validation. For example, the string “1” can be parsed as an integer with value 1, but it is not a valid integer in itself. This could lead to some surprising behaviour in your API. See <a href="https://github.com/samuelcolvin/pydantic/issues/578">this issue</a> for more background info.</blockquote><p>Other differences (unrelated to the API-first/code-first approach) are:</p><ul><li>Connexion is built on top of Flask and aiohttp, while FastAPI is built on top of Starlette. As a result, FastAPI is async by nature, while connexion is dependent on the underlying web framework (which can be changed).</li><li>FastAPI only generates OpenAPI 3 documentation, while connexion supports both Swagger 2 and OpenAPI 3 documents. This can be a factor in your decision making process as some tools do not support OpenAPI 3 (just yet), which might be used by the other party you are working with.</li></ul><h4>Benchmark</h4><p>So far, we have discussed the functional differences. Of course, we want to know what this actually means in terms of hard numbers. To do this, we performed a small benchmarking exercise to see the difference in throughput and latency between connexion (with Flask) vs FastAPI for a single endpoint of an application that is running in production.</p><p>It is important to note that we do not aim to perform a general benchmark between the two frameworks. Rather, we want to check what the concrete differences are for our particular application. You should never rely on external benchmarks using simple, synthetic examples, but instead run your own benchmark on your application when evaluating different options. <a href="https://blog.miguelgrinberg.com/post/ignore-all-web-performance-benchmarks-including-this-one">This blogpost</a> explains why in more detail. In our case, the API will need to run queries against a SQL database, and thus can benefit from async code to avoid blocking when waiting for the database to return the results.</p><p>In our case, we look at 2 different cases: the synchronous case and the asynchronous case. The setup for our benchmark consists of gunicorn with 10 workers (using the standard worker for flask, and <a href="https://www.uvicorn.org/deployment/#deployment">uvicorn.workers.UvicornWorker</a> for async frameworks). In the async case, we also use the gevent library, which enables to write synchronous code with Flask and will <a href="http://www.gevent.org/intro.html#monkey-patching">monkeypatch</a> the underlying code such that it becomes asynchronous without us having to worry about the event loop explicitly.</p><p>Note that we use an implementation of connexion with Quart that has not been fully integrated and tested.</p><p>For FastAPI, by using async def, you force the framework to run the function on the main event loop. So, you need to be cautious of not performing any blocking stuff. If you use regular def, FastAPI will schedule it on a separate ThreadpoolExecutor, so you don’t need to worry about blocking/non-blocking in that case. As a side effect, this also allows us to “force” synchronous behaviour with FastAPI (which is an asynchronous framework).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*VKXp5MKY8pJuWuvJMTHGzQ.png" /><figcaption>Benchmark results for sync and async versions</figcaption></figure><p>Looking at the numbers, we can see that in the synchronous setting connexion + flask outperform the synchronous FastAPI both in throughput and in latency. For the asynchronous case, we find that FastAPI outperforms connexion + quart (note: it’s possible that there is still some optimization possible in the Quart implementation for connexion). However, using gevent yields even better results and is the clear winner for this exercise.</p><h3>Moving forward</h3><p>At ML6, we like “<a href="https://www.ml6.eu/working-at-ml6#what-we-stand-for">doing rather than talking</a>” so we try to help and contribute to open source when applicable, which is why we want to help maintain connexion. As we believe it is still the right tool for us, if it is well-maintained.</p><p>One of the big changes we proposed that have already been incorporated into connexion is support for <a href="https://github.com/zalando/connexion/pull/1290">multiple authentication schemes in logical AND fashion</a>, which allows using for example 2 API keys in conjunction.</p><p>In addition, we have also just got the necessary permissions to release new versions to PyPI, which was a blocker up until now. The next steps include figuring out the future direction and the roadmap of connexion together with the community (<a href="https://github.com/zalando/connexion/issues/1395">https://github.com/zalando/connexion/issues/1395</a>). The big question for connexion’s future is where it creates the most value for its users: as a framework, or more when acting as middleware. We welcome all input here as this is important for all (potential) users of connexion, so don’t hesitate to leave your thoughts on the Github issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9f449877083" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ml6team/why-we-decided-to-help-maintain-connexion-c9f449877083">Why we decided to help maintain connexion</a> was originally published in <a href="https://medium.com/ml6team">ML6team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>