<?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[Converge Bio - Medium]]></title>
        <description><![CDATA[The Gen AI hub for Biotech - Medium]]></description>
        <link>https://medium.com/converge-bio?source=rss----4b5b6e693482---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Converge Bio - Medium</title>
            <link>https://medium.com/converge-bio?source=rss----4b5b6e693482---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 16:43:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/converge-bio" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[HuggingFace’s New Storage Revolution Evaluated On The Biggest Public Antibody Dataset]]></title>
            <link>https://medium.com/converge-bio/huggingfaces-new-storage-revolution-evaluated-on-the-biggest-public-antibody-dataset-f445476adf1d?source=rss----4b5b6e693482---4</link>
            <guid isPermaLink="false">https://medium.com/p/f445476adf1d</guid>
            <category><![CDATA[biology]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Oded Kalev]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 13:37:17 GMT</pubDate>
            <atom:updated>2026-03-16T13:37:17.065Z</atom:updated>
            <content:encoded><![CDATA[<h3>We Wanted to Train a Model on Antibody Sequences. We Ended Up Evaluating HuggingFace’s New Storage Revolution.</h3><h4>At Converge Bio, we’re training antibody language models on immune repertoires. But before you can train a model, you need data, real data at real scale.</h4><p>We recognized a gap: OAS-unpaired, one of the most important public antibody sequence resources, is invaluable for research but not packaged for production-scale ML workflows.<br>We’re releasing an open Hugging Face version of OAS-unpaired to make it easier for the broader research community to stream, query, and work with this data at scale and develop better drugs. The full corpus is now available for streaming, and per-study subsets let researchers load exactly the data they need without downloading billions of rows.</p><p>The dataset is available at: <a href="https://huggingface.co/datasets/ConvergeBio/oas-unpaired">ConvergeBio/OAS-unpaired</a></p><p>In the process, we also got to evaluate Hugging Face’s newer storage stack, Xet plus Parquet CDC, which makes updating very large Parquet datasets much more practical. That is what this post is about.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*o-IH-rtPthxX9tJeNNZj_w.gif" /></figure><h3>The Data: OAS Unpaired</h3><p>Antibodies are Y-shaped proteins produced by B cells, each shaped to recognize and bind a specific molecular target. This specificity has made them the backbone of modern therapeutics, with five of the top ten selling drugs worldwide being antibody-based. Over the past decade, next-generation sequencing (NGS) has let researchers read the genetic code of millions of antibodies from a single blood sample. These sequences have become the training data for a new generation of machine learning models. IgBert, IgT5, AntiBERTy, and AbLang all learn patterns from massive antibody datasets to enable computational drug design.</p><p>The <a href="https://opig.stats.ox.ac.uk/webapps/oas/">Observed Antibody Space</a> (OAS) is the largest public database of cleaned, annotated antibody sequences from next-generation sequencing studies, maintained by the <a href="https://opig.stats.ox.ac.uk/">Oxford Protein Informatics Group</a> (OPIG) at the University of Oxford [1][2]. It holds billions of sequences across 88 studies covering multiple species (human, mouse, rhesus macaque, and others), isotypes, and disease contexts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1yvU7wCCDXNxL_a3.png" /></figure><p>OPIG provides a <a href="https://opig.stats.ox.ac.uk/webapps/oas/oas_unpaired/">web-based search interface</a> that lets you filter sequences by species, disease, B cell type, tissue source, isotype, vaccine, and more. You can also submit a sequence and retrieve up to 1,000 matches with the same V and J germline genes. For targeted exploration of individual studies or specific subsets, this works well.</p><p>The underlying data, however, is distributed as thousands of individual .csv.gz files on their web server, one file per study, chain type (heavy or light), and isotype combination. There&#39;s no programmatic API, no column selection, no way to run a query across the full dataset at once. If you want to work with all 2.43 billion sequences, you need to download and parse <strong>15,568 separate files</strong>.</p><h3>The Setup</h3><p>For readers less familiar with data formats: OAS uses <strong>CSV</strong> (Comma-Separated Values), a plain-text format where each row is a line and columns are separated by commas. It’s the paper spreadsheet of the data world: simple, universal, and deeply inefficient at scale.</p><p>We converted everything to Parquet, a columnar binary format that organizes data by column rather than by row. CSV reads data row by row, like scrolling through a million-row spreadsheet to sum a single column. Parquet stores each column independently, allowing you to use only specific columns without downloading the full dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*uTU06jCywicCsXm2e6Cqrg.png" /></figure><p>Parquet also compresses dramatically better. A column of V-gene names (mostly values like “IGHV3–30” and “IGHV1–69”) compresses far more efficiently than a CSV row mixing gene names, amino acid sequences, quality scores, and metadata together.</p><p>The result: 4,030 Parquet files split into two configs: <em>heavy</em> with 2.07 billion sequences across 3,420 shards, <br> and <em>light</em> with 357 million sequences across 610 shards. Total size on disk: 2.45 TB, 114 columns per shard (99 AIRR<br> fields plus 13 metadata and 2 hash).</p><p>Now, anyone can stream the entire OAS unpaired database without downloading anything:</p><pre>from datasets import load_dataset<br>ds = load_dataset(&quot;ConvergeBio/oas-unpaired&quot;, &quot;heavy&quot;, split=&quot;train&quot;, streaming=True)</pre><p>The dataset is organized so that <strong>each of the 88 studies is its own subset</strong> within the <em>heavy</em> and <em>light</em> configs. This means you can also load a single study directly, useful if you’re working on a specific organism, disease, or experimental context:</p><pre># Load just one study<br>ds = load_dataset(&quot;ConvergeBio/oas-unpaired&quot;, &quot;Briney et al., 2019&quot;, split=&quot;heavy&quot;,<br>                  streaming=True)</pre><p>Or query across the entire database with SQL using <a href="https://duckdb.org/2024/05/29/access-150k-plus-datasets-from-hugging-face-with-duckdb">DuckDB’s HuggingFace integration</a> [3]. No download needed, just HTTP range requests against remote Parquet:</p><pre>-- Most common V-genes across all heavy chain sequences<br>SELECT v_call, COUNT(*) FROM &#39;hf://datasets/ConvergeBio/oas-unpaired/data/unpaired_heavy/**/*.parquet&#39;<br>GROUP BY v_call ORDER BY COUNT(*) DESC LIMIT 10;<br><br>-- Or drill into a single study<br>SELECT COUNT(*) FROM &#39;hf://datasets/ConvergeBio/oas-unpaired/data/unpaired_heavy/Bolland et al., 2016/*.parquet&#39;;<br></pre><p>So far so good. The interesting part came next.</p><h3>Adding a Column</h3><p>With the dataset uploaded, we wanted to assess its redundancy and perform basic EDA before training. Are the same sequences showing up across studies? How many unique sequences are there really?</p><p>You can’t just GROUP BY a variable-length amino acid string across 2.43 billion rows. That&#39;s expensive and slow. So we wanted to add a precomputed hash: take the sequence_alignment_aa column, run it through <a href="https://github.com/Cyan4973/xxHash">xxHash</a> [4] to get a 128-bit digest, and store that as two new columns (aa_hash_hi and aa_hash_lo, the high and low 64-bit halves).</p><p>For readers unfamiliar with hashing: imagine you have a library of a billion books and need to find duplicates. Comparing every book’s full text to every other book would take an astronomical number of operations. But if you stamp each book with a unique short fingerprint, a code derived deterministically from its content, then finding duplicates becomes trivial: just look for matching stamps. Two identical books always produce the same fingerprint. Two different books (with a good hash function) always produce different ones. That’s hashing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k6zztR3-4XFWZ_ui--3vrQ.png" /></figure><p>With the hash materialized in the dataset, any duplicate query becomes a GROUP BY on two integers. Fast, cheap, and you can do it remotely via DuckDB without downloading the full dataset.</p><p>Under <strong>Git LFS</strong>, which was HuggingFace Hub’s storage backend until the Xet migration began in early 2025, uploading a modified file means uploading the <em>entire</em> file. LFS works at file granularity. It doesn’t know or care that 112 out of 114 columns are identical to what’s already stored. Every byte of every shard would need to be re-transferred.</p><p>That’s <strong>2.19 TB of upload to add 16 bytes per row</strong>. At 100 Mbps, roughly two days of continuous transfer for two columns that represent about 2.8% of each file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*j1Z54zQWzi9zPSDbVQvB6g.png" /></figure><h3>Two Layers of Storage Innovation by Hugging Face</h3><p>The solution involves two technologies that must work together: one at the storage layer and one at the file format layer.</p><h3>Layer 1: XET (Storage)</h3><p>In August 2024, HuggingFace <a href="https://huggingface.co/blog/xethub-joins-hf">acquired XETHub</a> [5], a Seattle-based startup founded by ex-Apple ML infrastructure engineers. By early 2025, they deployed XET as the Hub’s new storage backend, and by May 2025, it became the default for all new repositories [6][7].</p><p>The key idea: instead of storing files as opaque blobs (like Git LFS does), XET splits every file into variable-sized chunks of about 64 KB using a <a href="https://github.com/srijs/rust-gearhash">GearHash</a> rolling hash. Each chunk gets hashed (Blake3) and stored in a global content-addressable store. When you upload a modified file, only the chunks that actually changed get transferred [8][9].</p><p>To give a sense of scale, as of October 2025, HuggingFace has migrated over 6 million repositories totaling 77+ petabytes from LFS to XET [10].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KHBfSxqC6YdsXmJBBZzQwA.png" /></figure><h3>Why XET Alone Isn’t Enough</h3><p>You’d think byte-level chunking would solve the Parquet problem, but it doesn’t. Here’s why.</p><p>Parquet is a columnar format: data is organized into row groups, and within each row group, each column is written as a series of compressed data pages. The critical detail is that <strong>standard Parquet writers determine page boundaries by counting rows</strong>, every N values start a new page.</p><p>When you add a column to a Parquet file, the row group metadata changes, byte offsets shift, and even though the actual column data is identical, the compression now operates on pages that start at slightly different positions. Different input positions produce different compressed bytes, and XET’s chunker sees different bytes and treats them as entirely new data.</p><p>We benchmarked this on a single 210 MB shard with 247K rows. Without any special handling, adding the hash columns resulted in only <strong>3.9% chunk overlap</strong> between the original and modified files. XET couldn’t deduplicate almost anything.</p><h3>Layer 2: Parquet CDC (File Format)</h3><p>The fix is <a href="https://huggingface.co/blog/parquet-cdc">Parquet Content-Defined Chunking</a>, a feature <a href="https://github.com/apache/arrow/pull/45360">contributed to Apache Arrow</a> by Krisztian Szucs, merged in May 2025, released in <a href="https://arrow.apache.org/blog/2025/07/17/21.0.0-release/">Apache Arrow 21.0.0</a> in July 2025 [11][12][13].</p><p>Instead of splitting data pages at fixed row counts, Parquet CDC uses a rolling hash (same GearHash family) over the actual column values to decide where to cut pages. Identical data sequences produce identical compressed pages regardless of their position in the file. When you add a column, the existing columns’ page boundaries don’t shift, because they’re determined by content, not by position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9I1KA9rl8oys28X1krjRiw.png" /></figure><p>with datasets&gt;=4.0.0 (which pins pyarrow&gt;=21.0.0 for Parquet CDC support) this is enabled by default</p><pre>from datasets import Dataset, load_dataset<br><br># 1. Load your CSV and push to Hub<br>ds = Dataset.from_csv(&quot;sequences.csv&quot;)<br>ds.push_to_hub(&quot;my-org/my-dataset&quot;)<br><br># 2. Later: load from Hub, add a column, push again<br>ds = load_dataset(&quot;my-org/my-dataset&quot;, split=&quot;train&quot;)<br>ds = ds.map(lambda x: {&quot;seq_length&quot;: len(x[&quot;sequence&quot;])})<br>ds.push_to_hub(&quot;my-org/my-dataset&quot;)<br># Only the new column&#39;s chunks are transferred</pre><p>With both layers working together, Parquet CDC at the format level and XET at the storage level, our benchmark showed <strong>98.8% chunk overlap</strong>. Only the new column data and some metadata were actually uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_g1HnBz0VXOVCw6K5W_Vg.png" /></figure><p>What would have been a multi-day upload became a lunch break.</p><p>Here we used this to add hash columns, but if you want to add any new feature, embedding, or tokenization to a large dataset, this will save you <strong>a</strong> <strong>lot of time</strong></p><h3><strong>Finding Duplicates</strong></h3><p>With hashes computed, we could finally quantify how redundant OAS actually is, redundant for our purpose, since we care about amino acid sequences.</p><p><strong>Why duplicates exist</strong></p><p>Every protein in nature is encoded by a gene, a stretch of DNA. The cell reads this DNA and translates it into a chain of amino acids. It’s the amino acid sequence that determines what the protein does, and it’s what we train our models on.</p><p>Translation works in triplets. Every three nucleotides in the DNA (called a codon) map to one amino acid. There are 64 possible codons, but only 20 amino acids, so multiple codons map to the same one. For example, four different codons — GCT, GCC, GCA, GCG — all produce the amino acid Alanine.</p><p>This means two DNA sequences can look completely different at the nucleotide level but encode the exact same protein. OAS stores nucleotide sequences, but we train on amino acid sequences. At that level, these are duplicates.</p><p>Antibodies specifically have additional sources of duplication. When the immune system finds an antibody that works, it amplifies it: the B cell that produces it divides rapidly, creating many copies of the same sequence. This is called clonal expansion. On top of that, sequencing the same blood sample across different experimental setups (targeting different antibody classes, such as IgG, IgM, or IgA) will capture the same underlying sequence multiple times. And across the hundreds of studies that make up OAS, overlapping patient populations and shared cell lines contribute further.</p><h3>The Numbers</h3><p>We ran duplicate detection across all 2.43 billion sequences and per study using the precomputed hash columns, a GROUP BY on two uint64 values, executed remotely via DuckDB against the HuggingFace-hosted Parquet files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vF2WWpntV2JKEOi_lpJV7g.png" /><figcaption>the full table is available at the dataset page on Hugging Face</figcaption></figure><h3>What We Learned</h3><p><strong>The toolchain is ready but barely documented.</strong> Parquet CDC shipped in Arrow 21.0.0 (July 2025), Xet became the default on HuggingFace in May 2025. The combination works, but figuring out the right approach required reading Apache Arrow PRs and HuggingFace engineering blog posts. There isn’t a “how to efficiently update a large Parquet dataset” guide yet. Consider this a start.</p><p><strong>AI coding assistants don’t know this stack yet.</strong> Even Claude kept defaulting to the old patterns: download the full dataset, process locally, re-upload the whole thing. Getting them to use hf:// URIs or leverage DuckDB&#39;s remote Parquet support required explicit correction every time. You need to know what to ask for.</p><p><strong>DuckDB + HuggingFace is underappreciated.</strong> SQL-querying 2.43 billion rows directly on HuggingFace with no download and no local database changes how you think about data exploration. Our duplicate detection query runs against remote Parquet shards. It’s not fast, but it works, and you don’t need to provision anything [3].</p><p><strong>Content-defined chunking is a principle, not a single technology.</strong> The same idea — using content to determine boundaries — appears at three levels in this project: PyArrow uses it to decide Parquet page boundaries from column values, Xet uses it to decide storage chunk boundaries from file bytes, and our hash columns use it for application-level deduplication. Each layer solves a different problem with the same underlying insight.</p><p><strong>Open data infrastructure matters as much as the science.</strong> The sequences in OAS were always open, but accessing them at scale required days of engineering before any science could begin. Converting to Parquet, hosting on HuggingFace, and validating every row is what turns “technically available” into “actually usable.”</p><p><strong>The dataset is open access.</strong> We’re releasing it for the community, for ML researchers training antibody language models, for biologists querying specific studies or species, and for drug discovery teams building reproducible pipelines. The whole point of open data is what the community builds with it.</p><p><strong>The side quest was worth it.</strong> We set out to prepare training data for our antibody language models. We ended up with the largest publicly accessible copy of OAS unpaired on HuggingFace, validated against every original source file, and along the way got to benchmark HuggingFace’s new Xet storage and Parquet CDC, infrastructure that makes maintaining multi-terabyte biological datasets practical without blocking out a weekend every time you want to add a column.</p><h3>References</h3><p>[1] Kovaltsuk A, Leem J, Kelm S, Snowden J, Deane CM, Krawczyk K. “Observed Antibody Space: A Resource for Data Mining Next-Generation Sequencing of Antibody Repertoires.” <em>J Immunol.</em> 2018; 201(8):2502–2509. <a href="https://pubmed.ncbi.nlm.nih.gov/30217829/">PubMed</a></p><p>[2] Olsen TH, Boyles F, Deane CM. “Observed Antibody Space: A diverse database of cleaned, annotated, and translated unpaired and paired antibody sequences.” <em>Protein Science.</em> 2022; 31(1):141–146. <a href="https://doi.org/10.1002/pro.4205">DOI</a></p><p>[3] “Access 150k+ Datasets from Hugging Face with DuckDB.” DuckDB Blog, May 29, 2024. <a href="https://duckdb.org/2024/05/29/access-150k-plus-datasets-from-hugging-face-with-duckdb">duckdb.org</a></p><p>[4] Yann Collet. xxHash, Extremely fast non-cryptographic hash algorithm. <a href="https://xxhash.com/">xxhash.com</a> / <a href="https://github.com/Cyan4973/xxHash">GitHub</a></p><p>[5] “XetHub is joining Hugging Face!” HuggingFace Blog, August 8, 2024. <a href="https://huggingface.co/blog/xethub-joins-hf">huggingface.co/blog/xethub-joins-hf</a></p><p>[6] “From Files to Chunks: Improving HF Storage Efficiency.” HuggingFace Blog, November 20, 2024. <a href="https://huggingface.co/blog/from-files-to-chunks">huggingface.co/blog/from-files-to-chunks</a></p><p>[7] “Xet is on the Hub.” HuggingFace Blog, March 18, 2025. <a href="https://huggingface.co/blog/xet-on-the-hub">huggingface.co/blog/xet-on-the-hub</a></p><p>[8] “From Chunks to Blocks: Accelerating Uploads and Downloads on the Hub.” HuggingFace Blog, February 12, 2025. <a href="https://huggingface.co/blog/from-chunks-to-blocks">huggingface.co/blog/from-chunks-to-blocks</a></p><p>[9] Xet Protocol Specification v1.0.0, Content-Defined Chunking. <a href="https://huggingface.co/docs/xet/en/chunking">huggingface.co/docs/xet/en/chunking</a></p><p>[10] “huggingface_hub v1.0.” HuggingFace Blog, October 27, 2025. <a href="https://huggingface.co/blog/huggingface-hub-v1">huggingface.co/blog/huggingface-hub-v1</a></p><p>[11] “Parquet Content-Defined Chunking.” HuggingFace Blog, July 25, 2025. <a href="https://huggingface.co/blog/parquet-cdc">huggingface.co/blog/parquet-cdc</a></p><p>[12] Apache Arrow PR #45360, Content-Defined Chunking for Parquet. Created January 27, 2025; merged May 13, 2025. <a href="https://github.com/apache/arrow/pull/45360">github.com/apache/arrow/pull/45360</a></p><p>[13] Apache Arrow 21.0.0 Release. July 17, 2025. <a href="https://arrow.apache.org/blog/2025/07/17/21.0.0-release/">arrow.apache.org/blog/2025/07/17/21.0.0-release/</a></p><p>[14] “Improving Parquet Dedupe on Hugging Face Hub.” HuggingFace Blog, October 5, 2024. <a href="https://huggingface.co/blog/improve_parquet_dedupe">huggingface.co/blog/improve_parquet_dedupe</a></p><p>[15] “Migrating the Hub from Git LFS to Xet.” HuggingFace Blog, July 15, 2025. <a href="https://huggingface.co/blog/migrating-the-hub-to-xet">huggingface.co/blog/migrating-the-hub-to-xet</a></p><p>[16] OAS, Observed Antibody Space. OPIG, University of Oxford. <a href="https://opig.stats.ox.ac.uk/webapps/oas/">opig.stats.ox.ac.uk/webapps/oas/</a></p><p>[17] HuggingFace Datasets, Streaming. <a href="https://huggingface.co/docs/datasets/en/stream">huggingface.co/docs/datasets/en/stream</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f445476adf1d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/converge-bio/huggingfaces-new-storage-revolution-evaluated-on-the-biggest-public-antibody-dataset-f445476adf1d">HuggingFace’s New Storage Revolution Evaluated On The Biggest Public Antibody Dataset</a> was originally published in <a href="https://medium.com/converge-bio">Converge Bio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Web Servers Are Easy… Until They’re Not]]></title>
            <link>https://medium.com/converge-bio/python-web-servers-are-easy-until-theyre-not-120f31b5992e?source=rss----4b5b6e693482---4</link>
            <guid isPermaLink="false">https://medium.com/p/120f31b5992e</guid>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[autoscaling]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Eyal Sol]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 06:32:31 GMT</pubDate>
            <atom:updated>2025-08-29T09:35:12.940Z</atom:updated>
            <content:encoded><![CDATA[<h4>How a Simple FastAPI Bug Taught Us What “Async” Really Means</h4><h3>Before We Start — Some Prerequisites</h3><ul><li>Basic familiarity with FastAPI or async Python web frameworks</li><li>Understanding of async/await syntax</li><li>Interest in production Python gotchas</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ku9Pfs_APBiqbI3JX7knA.png" /></figure><h3>Chapter 1 — The Bug That Shouldn’t Exist</h3><p>For three months, we had a production bug that made no sense. Our FastAPI service would <em>occasionally</em> become unresponsive during ML model inference — maybe 1–2% of health checks would fail, always during inference, but never predictably.</p><p>The sporadic nature made it nearly impossible to debug. Most health checks responded fine, but those unlucky few that arrived right as inference started? They’d timeout after 5–10seconds. Just enough failures to trigger autoscaling issues, but not enough to easily identify the pattern.</p><p>Our code looked perfectly reasonable:</p><pre>@app.post(&quot;/invocations&quot;)<br>async def invocations(request: Request):<br>    data = await request.json()<br>    result = await predict(data)  # PyTorch inference<br>    return result<br><br>@app.get(&quot;/health&quot;)<br>async def health_check():<br>    return {&quot;status&quot;: &quot;healthy&quot;}</pre><p>We spent months investigating infrastructure issues, autoscaling policies, and container configurations. But the problem was much more fundamental — we didn’t actually understand what async means in Python.</p><h3>Chapter 2 — What We Thought Async Did</h3><p>Like many Python developers, we had a mental model of async that went something like this:</p><p><em>“If I mark a function as </em><em>async, it won&#39;t block other requests. The server can handle multiple things at once.&quot;</em></p><p>This mental model works great for I/O operations — database queries, API calls, file operations. When you await an I/O operation, Python&#39;s event loop can switch to handling other requests. It&#39;s cooperative multitasking at its finest.</p><p>But here’s what we missed: <strong>CPU-bound operations don’t cooperate</strong>.</p><h3>Chapter 3 — The Event Loop Reality Check</h3><p>Python’s <em>asyncio</em> runs on a single thread with an event loop. Think of it as a waiter in a restaurant:</p><ul><li><strong>I/O operations</strong> are like taking orders — the waiter starts the order, sends it to the kitchen, and can serve other tables while waiting</li><li><strong>Synchronous operations</strong> are like the waiter standing frozen at one table until the entire meal is served</li></ul><p>Our PyTorch model inference, even though it ran on GPU, was called synchronously. The Python thread would submit work to the GPU and then wait for results. During that wait, the event loop was blocked — no other request could be processed.</p><p>The async keyword doesn&#39;t magically make code non-blocking. If the function does blocking operations (even just waiting for GPU results), it still blocks everything.</p><h3>Chapter 4 — Understanding the Difference</h3><p>Let me show you the actual difference with a concrete example:</p><pre># ❌ This blocks the event loop<br>@app.post(&quot;/invocations&quot;)<br>async def invocations(request: Request):<br>    data = await request.json()<br>    result = await predict(data)  # Blocks event loop<br>    return result<br><br># During those 5-10 seconds:<br># - /health returns nothing<br># - /status times out  <br># - New requests queue up<br># - The server appears &quot;dead&quot;</pre><pre># ✅ This keeps the event loop responsive<br>from starlette.concurrency import run_in_threadpool<br><br># Sync function for heavy work<br>def predict(data: dict):<br>    return model.predict(data)<br><br>@app.post(&quot;/invocations&quot;)<br>async def invocations(request: Request):<br>    data = await request.json()                           # light work on loop<br>    result = await run_in_threadpool(predict, data)       # offload to thread pool<br>    return result<br><br># During processing:<br># - /health responds immediately<br># - /status works fine<br># - New requests are accepted<br># - The server stays responsive</pre><p>The key difference? We’re offloading CPU-bound work to a separate thread, keeping the event loop free to handle other requests.</p><h3>Chapter 5 — But What About the GIL?</h3><p>If you know Python well, you might be wondering: “Wait, doesn’t the Global Interpreter Lock (GIL) prevent true parallel execution in threads?”</p><p>Yes and no. The GIL prevents multiple threads from executing Python bytecode simultaneously. But here’s the important part: <strong>libraries like NumPy and PyTorch release the GIL during computations</strong>.</p><p>When PyTorch runs inference (whether on CPU or GPU), it’s executing optimized C++/CUDA code that releases the GIL. Your thread pool can run multiple inferences in parallel, and the main event loop thread stays responsive.</p><p><strong>The key insight</strong>: Even with GPU inference, your Python thread blocks waiting for results. Without run_in_threadpool, that waiting happens on the main event loop thread, blocking everything else.</p><h3>Chapter 6 — The Fix That Took 5 Minutes (After 3 Months)</h3><p>Our solution was embarrassingly simple:</p><pre>from starlette.concurrency import run_in_threadpool<br><br># Sync function for heavy work<br>def predict(data: dict):<br>    return model.predict(data)<br><br>@app.post(&quot;/invocations&quot;)<br>async def invocations(request: Request):<br>    data = await request.json()                           # light work on loop<br>    result = await run_in_threadpool(predict, data)       # offload to thread pool<br>    return result</pre><p>That’s it. The health checks started responding. The server stayed responsive during inference. The mysterious freezes disappeared.</p><p><strong>Note:</strong> By default, run_in_threadpool uses AnyIO&#39;s thread limiter with 40 threads. For handling more concurrent requests, you might need to adjust this limit during startup, but for most ML inference workloads, the default is sufficient.</p><h3>Chapter 7 — Lessons for Production Python Services</h3><p>After this experience, here’s what we check for:</p><h4>Know Your Operations</h4><p><strong>I/O-bound operations</strong> (good for async):</p><ul><li>Database queries, HTTP requests, Redis calls</li></ul><p><strong>Blocking operations</strong> (need thread/process pools):</p><ul><li>ML model inference (GPU or CPU)</li><li>Waiting for GPU computation</li><li>Large data preprocessing</li></ul><h4>Quick Test</h4><pre># Start your server and run this<br># If health check times out during inference, you have a blocking problem<br>async def test_responsiveness():<br>    # Start a long-running inference<br>    inference_task = session.post(&quot;http://localhost:8000/inference&quot;, json={...})<br>    # Health check should still respond quickly<br>    health_response = await session.get(&quot;http://localhost:8000/health&quot;)</pre><h3>Wrapping Up</h3><p>We spent three months debugging infrastructure when the problem was simple: <strong>Async doesn’t mean parallel</strong>.</p><p>That sporadic 2% failure rate taught us that the hardest bugs are the ones that barely show up. If you’re building Python web services with heavy computation, just remember: offload blocking work to thread pools.</p><p><em>At </em><a href="https://converge-bio.com/"><em>Converge Bio</em></a><em>, we’re building the future of drug discovery with AI. These are the kinds of lessons we learn along the way.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=120f31b5992e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/converge-bio/python-web-servers-are-easy-until-theyre-not-120f31b5992e">Python Web Servers Are Easy… Until They’re Not</a> was originally published in <a href="https://medium.com/converge-bio">Converge Bio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Production-Ready Terraform Setup Powered by Digger CI/CD]]></title>
            <link>https://medium.com/converge-bio/production-ready-terraform-setup-powered-by-digger-ci-cd-47f18803cdd9?source=rss----4b5b6e693482---4</link>
            <guid isPermaLink="false">https://medium.com/p/47f18803cdd9</guid>
            <category><![CDATA[computational-biology]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[biology]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Amit Lavi]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 07:33:06 GMT</pubDate>
            <atom:updated>2025-07-21T07:50:02.889Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A real-world Terraform setup with centralized state, GitHub OIDC, Digger workflows, and automated PR plans, <strong>fully copy-pasteable</strong>.</blockquote><h3>Before We Start — What You’ll Get From This Post</h3><ul><li>A repeatable way to manage Terraform across many projects without drowning in state files.</li><li>A lean CI/CD workflow built with <a href="https://digger.dev/">Digger</a> that auto-discovers projects.</li><li>A clear separation between staging and production, while keeping feedback fast.</li><li>Copy-paste-ready code snippets for buckets, backends, and workflow files.</li></ul><blockquote>Prerequisites: Familiar with basic Terraform commands and GitHub Actions. No deep AWS experience required.</blockquote><h3>Why We Need a Better Routine</h3><p>Terraform is great until you end up with ten environments, twenty remote states, and CI logs that read like a thriller novel. We wanted something simpler:</p><ol><li>One remote state bucket we can secure and monitor.</li><li>No long-lived AWS keys in CI.</li><li>Automatic project discovery enables teams to add infrastructure without touching the pipeline.</li><li>Pull-request centred workflow: Digger posts terraform plan as a comment so reviewers can discuss infrastructure changes and trigger apply directly from the PR.</li><li>Fast feedback in staging, guard-rails in production.</li><li>Shift-left culture (Teams is the root of the directory tree): empowering developers to own infrastructure changes through familiar PR workflows, increasing usability across the organisation.</li></ol><p>Everything you’ll see next addresses at least one of those points, and importantly, brings infrastructure reviews into the same workflow developers already use for application code.</p><p>No separate dashboards, no out-of-band approvals. Plans are visible where conversations happen, making feedback faster and more actionable.</p><h3>Solution Building Blocks</h3><h4>Folder structure</h4><ul><li>teams/&lt;team&gt;/aws/... → Team-owned infra (shift-left), auto-discovered by Digger.</li><li>global/... → Global Shared resources (state bucket, OIDC, ECR and more organization-wide modules).</li><li>modules/... → Reusable Terraform modules (Lambda, Step-Functions, provider wrappers).</li><li>.github/workflows/... → CI: Digger workflows, pre-commit checks, module releases.</li></ul><h4>Centralized State</h4><ul><li><strong>One S3 bucket</strong> (versioned, private) for all workspaces.</li><li>use_lockfile = true for remote locking, no separate DynamoDB.</li><li>Org-wide IAM policy grants controlled access via aws:PrincipalOrgID</li></ul><h4>Github OIDC</h4><ul><li>Short-lived AWS creds, no long-lived keys.</li><li>Single OIDC role assumed by Digger across accounts.</li></ul><h4>Environment Separation</h4><ul><li>We chose to structure the environment based on the team responsible for managing it and the underlying provider it runs on, as this is a critical aspect of how our CI will function.</li><li><strong>Staging</strong> → fast feedback, dev-apply in PR.</li><li><strong>Production</strong> (branch protection enforced) → plan must pass and human approval.</li><li>Defined by glob patterns digger.yaml for auto-wiring CI.</li></ul><h4>Digger CI/CD</h4><ul><li>Auto-discovers projects via file-path globs.</li><li>Posts terraform plan as PR comments.</li><li>Separate workflows per environment, per project.</li></ul><h4>Quality &amp; Automation</h4><ul><li><strong>Pre-commit hooks</strong> enforce formatting, linting, docs, secret scanning.</li><li><strong>Module-release workflow</strong> auto-tags and publishes reusable modules on merge.</li></ul><h3>Folder Structure Reference</h3><p>All directory paths in the upcoming code samples <strong>follow the structure below</strong>. Feel free to adapt it, but keep the same hierarchy if you want project auto-generation (Chapter 4) to work without extra configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*rHj2f3CzvnJsMf_nVWwv7g.png" /></figure><h3>Chapter 1— Centralising State in a Single S3 Bucket</h3><h4>One bucket, versioning on, public access off.</h4><p>First, create the resource locally while connected to the appropriate shared backend account handler. Once it’s created, run terraform initagain, and Terraform will prompt you to migrate the local state to the shared remote backend.</p><p><strong>(1) Define a shared backed bucket organization-wide read-write policy</strong></p><blockquote>We’ll use AWS given organization role <em>OrganizationAccountAccessRole</em></blockquote><pre>data &quot;aws_iam_policy_document&quot; &quot;organization_access_config&quot; {<br>  statement {<br>    principals {<br>      type        = &quot;AWS&quot;<br>      identifiers = [&quot;arn:aws:iam::*:role/OrganizationAccountAccessRole&quot;]<br>    }<br>    actions = [&quot;s3:PutObject&quot;]<br>    resources = [<br>      module.s3_bucket.s3_bucket_arn,<br>      &quot;${module.s3_bucket.s3_bucket_arn}/*&quot;,<br>    ]<br>    condition {<br>      test     = &quot;StringEquals&quot;<br>      variable = &quot;aws:PrincipalOrgID&quot;<br>      values   = [data.aws_organizations_organization.org.id]  <br>    }<br>    condition {<br>      test     = &quot;StringEquals&quot;<br>      variable = &quot;s3:x-amz-acl&quot;<br>      values   = [&quot;bucket-owner-full-control&quot;]<br>    }<br>  }<br>  statement {<br>    principals {<br>      type        = &quot;AWS&quot;<br>      identifiers = [&quot;arn:aws:iam::*:role/OrganizationAccountAccessRole&quot;]<br>    }<br>    actions = [&quot;s3:ListBucket&quot;, &quot;s3:GetObject&quot;, &quot;s3:GetObjectAcl&quot;, &quot;s3:PutObjectAcl&quot;]<br>    resources = [<br>      module.s3_bucket.s3_bucket_arn,<br>      &quot;${module.s3_bucket.s3_bucket_arn}/*&quot;,<br>    ]<br>    condition {<br>      test     = &quot;StringEquals&quot;<br>      variable = &quot;aws:PrincipalOrgID&quot;<br>      values   = [data.aws_organizations_organization.org.id]  }<br>  }<br>}</pre><p><strong>(2) Create a shared state backend bucket</strong></p><blockquote>Decide in which account you think it should be placed in, I’ve used my organization management account.</blockquote><pre># global/cloud/aws/backend/main.tf<br>module &quot;s3_bucket&quot; {<br>  source  = &quot;terraform-aws-modules/s3-bucket/aws&quot;<br>  bucket  = &quot;example-terraform-state-shared-backend&quot;<br>    acl     = &quot;private&quot;<br>    versioning = {<br>      enabled = true<br>    }<br>    # Attach the organization-wide read/write policy<br>    attach_policy = true<br>    policy        = data.aws_iam_policy_document.organization_access_config.json<br>    tags = {<br>          Name = &quot;${var.organization_name}-terraform-state-shared-backend&quot;<br>        }<br>    }</pre><p><strong>(3) In each sub-module, use the shared backend</strong></p><blockquote>Important note use_lockfile it’s kind of new feature that replace the deprecated DynamoDB locking, it applicable from Terraform V1.11.x, you can read more <a href="https://developer.hashicorp.com/terraform/language/backend/s3">here</a></blockquote><p>Under each sub-moduleproviders.tfAdd the following and run terraform init</p><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket       = &quot;{ORGANIZATION_NAME}-terraform-state-shared-backend&quot;<br>    key          = &quot;&lt;team&gt;/&lt;provider&gt;/&lt;environment&gt;/&lt;region&gt;/&lt;project&gt;/terraform.tfstate&quot;<br>    region       = &quot;us-east-1&quot;<br>    use_lockfile = true<br>  }<br>}</pre><p><strong>Why this matters</strong></p><ul><li>Avoid the need to switch accounts for each sub-module during plan or apply operations.</li><li>Auditing is simpler when all state lives in a single place.</li><li>One lock table for each workspace → no race conditions.</li><li>Rollbacks are one aws s3 cp away thanks to versioning.</li></ul><h3>Cross-State resources and references</h3><p>Our goal is to keep Terraform modules isolated by default, only interacting through explicitly defined outputs. This approach promotes encapsulation, minimizes unintended dependencies, and keeps our infrastructure clean and modular.</p><p>When a module <strong>needs</strong> to consume data from another, we use the terraform_remote_state data block to reference outputs from the source module’s remote state. This allows controlled, intentional sharing of data between modules.</p><p><strong>Best Practice:</strong></p><p>Only expose what’s necessary using output blocks — this helps prevent leaking sensitive or internal-only details and enforces module encapsulation.</p><h4>Example: Referencing a VPC module’s state</h4><p>Suppose we have a VPC defined under: teams/platform/aws/staging/us-east-1/vpc and we want to reference its VPC ID in another moduleץ</p><p><strong>In the VPC module</strong>, we expose the VPC ID explicitly</p><pre>output &quot;vpc_id&quot; {<br>  description = &quot;ID of the VPC&quot;<br>  value       = module.vpc.vpc_id<br>}</pre><p><strong>In the consuming module</strong>, we configure a terraform_remote_state data block to access that state</p><pre>data &quot;terraform_remote_state&quot; &quot;vpc&quot; {<br>  backend = &quot;s3&quot;<br>  config = {<br>    bucket = &quot;{ORGANIZATION_NAME}-terraform-state-shared-backend&quot;<br>    key    = &quot;teams/platform/aws/staging/us-east-1/vpc/terraform.tfstate&quot;<br>    region = &quot;{YOUR_SHARED_STATE_BUCKET_REGION}&quot;<br>  }<br>}</pre><p>If the VPC module owner has exposed the vpc_id output, we can now reference it like this</p><pre>module &quot;my_app&quot; {<br>  vpc_id     = data.terraform_remote_state.vpc.outputs.vpc_id<br>  # ... other variables<br>}</pre><h3>Chapter 2— Short-Lived AWS Access With GitHub OIDC</h3><blockquote>For convenience, you can create an IAM user and use its access keys as secrets in GitHub, though this approach is <strong>not recommended</strong> for security reasons.</blockquote><p><strong>(1) Define a shared backed bucket organization-wide read-write policy</strong></p><blockquote>We’ll use AWS given organization role <em>OrganizationAccountAccessRole , </em>Even admin access <strong>does not override</strong> the need for sts:AssumeRole permissions, AWS strictly separates these concerns for security.</blockquote><pre>data &quot;aws_iam_policy_document&quot; &quot;cross_account_assume&quot; {<br>  statement {<br>    effect = &quot;Allow&quot;<br>    actions = [<br>      &quot;sts:AssumeRole&quot;<br>    ]<br>    resources = [<br>      &quot;arn:aws:iam::*:role/OrganizationAccountAccessRole&quot;<br>    ]<br>    condition {<br>          test     = &quot;StringEquals&quot;<br>          variable = &quot;aws:PrincipalOrgID&quot;<br>          values   = [data.aws_organizations_organization.org.id]<br>        }<br>      }<br>    }</pre><p><strong>(2) Create policy from (1) policy and the OIDC itself</strong></p><pre>resource &quot;aws_iam_policy&quot; &quot;cross_account_assume&quot; {<br>  name        = &quot;github-oidc-cross-account-access&quot;<br>  description = &quot;Allows GitHub OIDC role to assume roles in organization member accounts&quot;<br>  policy      = data.aws_iam_policy_document.cross_account_assume.json<br>}<br><br>module &quot;github_oidc_provider&quot; {<br>  depends_on = [aws_iam_policy.cross_account_assume]<br>  source     = &quot;terraform-module/github-oidc-provider/aws&quot;<br>  create_oidc_provider = true<br>  create_oidc_role     = true<br>  repositories              = var.github_iac_repositories<br>  oidc_role_attach_policies = [&quot;arn:aws:iam::aws:policy/AdministratorAccess&quot;, aws_iam_policy.cross_account_assume.arn]<br>  tags = {<br>    Name = &quot;GitHubOIDC&quot;<br>  }<br>}</pre><p>Every Digger run now assumes an IAM role from each target account via the OIDC, nothing to rotate, nothing to leak.</p><h3>Checkpoint — Progress So Far</h3><p>Congratulations! You now have a fully functional setup with:<br> • Shared state backend<br> • GitHub OIDC integration<br> • Cross-account access via a centralized OIDC role</p><p>This means you can confidently manage all your AWS accounts, Terraform state, and resources from a single, secure control point without needing long-lived credentials and account switches.</p><p>You’re now perfectly positioned to take the next big step: implementing CI/CD with <a href="https://digger.dev/">Digger</a>.</p><h3>TL;DR — But what is Digger?</h3><p>Digger is an <strong>open-source</strong> CI/CD tool for Terraform that runs directly in your GitHub Actions. It automates plan/apply workflows securely using GitHub OIDC.</p><h4>We chose Digger for three main reasons:</h4><ul><li>Open source &amp; zero hosting overhead: install the GitHub App, give it minimal permissions, and you’re done.</li><li>Native PR experience: Every plan is posted as a comment. Maintainers can reply, request changes, or run /digger apply when ready.</li><li>Configuration-as-code: a single digger.yml At the repo root level defines how folders map to Terraform projects (state files) and which workflow (staging or production) they should follow.</li></ul><p>Digger analyzes the file changes in a pull request, maps them to the relevant Terraform projects, and triggers a separate workflow for each. This ensures runs are <strong>isolated and asynchronous</strong>, allowing multiple teams to work on unrelated states without interference. Even within a single PR, Digger can <strong>trigger multiple independent workflows</strong> as needed.</p><h4>Prerequisites</h4><ul><li>A GitHub repository with valid Terraform code: <strong>Chapter 2</strong></li><li>AWS Accesses: <strong>Chapter 3</strong></li><li>Digger <a href="https://github.com/apps/digger-cloud/installations/select_target">GitHub App</a> installed</li></ul><h4>What it actually looks like in the pull request</h4><p>There are more details about the Digger comments and outputs but I’ve added a run that has both succeeded and failed, so you’ll have a grasp and some motivation on why it’s so useful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*MfaY6DK9aXH5OGvU13l7eQ.png" /></figure><p>Each plan will get a comment with the actual plan data (same for apply)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*BJvSPeF7GaD1Ku7F1J6juQ.png" /></figure><h3>Chapter 3— Auto-Generating Projects With Digger and Global Configurations</h3><blockquote>Keep these configurations as a reference. If you’re unsure what works best for your use case, consult with your colleagues and establish practices that align with your company’s standards and workflows.</blockquote><p><strong>(1) Auto-generate projects per path</strong></p><blockquote>We’ll logically separate Staging, Production, and Global resources. For now, consider this a given, we’ll refine and expand on the structure in the next chapter</blockquote><p>Under digger.yaml We discussed in the TL;DR section, add the following project definition:</p><pre>generate_projects:<br>  blocks:<br>    # teams/{team}/aws/staging/{region}/{project}<br>    - include: &quot;teams/*/*/staging/*/*&quot;<br>      exclude: &quot;**/.terraform/**&quot;<br>      workflow: &quot;staging&quot;<br>    # teams/{team}/aws/production/{region}/{project}<br>    - include: &quot;teams/*/*/production/*/*&quot;<br>      exclude: &quot;**/.terraform/**&quot;<br>      workflow: &quot;production&quot;<br>    # global/{subject}/{provider}/{module}<br>    - include: &quot;global/*/*/*&quot;<br>      exclude: &quot;**/.terraform/**&quot;<br>      workflow: &quot;production&quot;</pre><p>Add a new folder that matches one of these blocks, commit, open a PR, and Digger handles the rest.</p><p><strong>(2) Global Digger File Configurations</strong></p><blockquote>Digger provides a global configuration options you can set. Refer to the <a href="https://docs.digger.dev/readme/introduction">Digger Docs</a> if you feel you’re missing something</blockquote><p>Under the same digger.yamlfile at the root of your repo, customize it to suit your needs. Here’s what we’re currently using:</p><pre>auto_merge: false<br>pr_locks: true</pre><p>Personally, I prefer to keep auto_merge disabled, but go with whatever fits your workflow. We’re a small team, so pr_lockshelps us avoid conflicts, though in larger teams it might slow things down. Choose what works best for you.</p><p><strong>(3) Digger Plan Bucket</strong></p><p>Using a plan bucket is also recommended. We’re using one, but I didn’t want to dive too deep into extra details here. If you’re interested, you can check it out here — <a href="https://docs.digger.dev/ce/features/plan-persistence#plan-persistence">Plan Persistence</a>.</p><h3>Chapter 4— Two-Lane Workflow: Fast Staging, Safe Production</h3><p>Here’s where the separation logic starts to matter. We want to allow developers to apply changes to staging or development environments <strong>without requiring maintainer approval</strong>. (Of course, this isn’t a given approach. Every organization sets its own rules.)</p><p>To support this, we’ve defined <strong>two separate workflow lanes</strong>, each with its own set of rules and permissions.</p><h4>Staging — Immediate Feedback</h4><pre>workflows:<br>  staging:<br>    plan:<br>      steps:<br>        - run: echo &quot;STAGING – starting plan step&quot;<br>        - init<br>        - plan<br>    apply:<br>      steps:<br>        - run: echo &quot;STAGING – starting apply step&quot;<br>        - init<br>        - apply<br>    workflow_configuration:<br>      on_pull_request_pushed: [&quot;digger plan&quot;]<br>      on_pull_request_closed: [&quot;digger unlock&quot;]<br>      on_commit_to_default: [&quot;digger unlock&quot;]<br>      skip_merge_check: true  # Let Dev Apply before the branch is mergable</pre><h4>Production — Extra Guard-Rails</h4><pre>workflows:<br>  prod:<br>    plan:<br>      steps:<br>        - run: echo &quot;PROD – starting plan step&quot;<br>        - init<br>        - plan<br>    apply:<br>      steps:<br>        - run: echo &quot;PROD – starting apply step&quot;<br>        - init<br>        - apply<br>    workflow_configuration:<br>      on_pull_request_pushed: [&quot;digger plan&quot;]<br>      on_pull_request_closed: [&quot;digger unlock&quot;]<br>      on_commit_to_default: [&quot;digger unlock&quot;]<br>      # The branch have to be mergable before applying</pre><p>Production omits skip_merge_check, so GitHub branch protection requires the plan to pass and a human approval before any change is applied.</p><h4>Workflow summary diagram</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*9ZnbShwPSitO8MXS_33K4g.png" /></figure><blockquote>Let’s see if you’re following along, based on Chapters 3 and 4:</blockquote><blockquote><strong>If you make a change to a sub-module within the global directory, which workflow will be triggered?</strong></blockquote><blockquote>(You’ll find the answer after Chapter 5.)</blockquote><h3>Chapter 5— GitHub Actions Workflow</h3><p>As we’ve discussed, the Digger app extracts project data, identifies differences, and triggers workflows. Now, we’re moving on to defining those workflows at the GitHub Actions level under /github/workflows/digger_workflow.yml</p><pre>name: Digger Workflow<br>on:<br>  workflow_dispatch:<br>    inputs:<br>      spec:<br>        description: &#39;Digger specification for the workflow&#39;<br>        required: true<br>      run_name:<br>        description: &#39;Optional run name for the workflow&#39;<br>        required: false<br>jobs:<br>  digger-job:<br>    runs-on: ubuntu-latest<br>    permissions:<br>      contents: write      # required to merge PRs<br>      actions: write       # required for plan persistence<br>      id-token: write      # required for workload-identity-federation<br>      pull-requests: write # required to post PR comments<br>      issues: read         # required to check if PR number is an issue or not<br>      statuses: write      # required to validate combined PR status<br>    steps:<br>      - uses: actions/checkout@v4<br>      - name: Display job info # Dispatched workflow names comes from here<br>        run: echo &quot;job id ${{ fromJSON(github.event.inputs.spec).job_id }}&quot;<br>        if: github.event.inputs.spec != &#39;&#39;<br>    <br>      # Run Digger<br>      - uses: diggerhq/digger@vLatest<br>        with:<br>          digger-spec: ${{ inputs.spec }}<br>          setup-aws: true.                  # On the runner machine<br>          setup-terraform: true.            # On the runner machine<br>          terraform-version: &quot;1.12.1&quot;       # Use your own used tf version<br>          aws-role-to-assume: ${{ secrets.AWS_ROLE_ARN }} # OIDC Role<br>          aws-region: us-east-1             # Can be changed obviously      <br>          upload-plan-destination: &#39;aws&#39;.   # Since the plans bucket is S3<br>          upload-plan-destination-s3-bucket: &#39;{NAME_OF_YOUR_PLAN_BUCKET (Chapter 5-(3))}&#39;  #<br>          reporting-strategy: multiple_comments. # Wheter to post each plan in it&#39;s own comment<br>        <br>        # Optional if you&#39;re using remote modules from your own private repo<br>        env:<br>          GITHUB_CONTEXT: ${{ toJson(github) }}<br>          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}<br>          GIT_CONFIG_COUNT: &quot;1&quot;<br>          GIT_CONFIG_KEY_0: &quot;url.https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/.insteadOf&quot;<br>          GIT_CONFIG_VALUE_0: &quot;ssh://git@github.com/&quot;</pre><blockquote><strong>The answer you’re looking for:</strong></blockquote><blockquote>In Chapter 3, within the generation block, you’ll see that the <strong>third rule set</strong> is designated for <strong>global resources</strong>. This rule dispatches a workflow tagged as <strong>“production” </strong>which makes sense, given the nature of global infrastructure.</blockquote><h3>Chapter 6— Day-to-Day Flow</h3><ol><li>Create a directory, e.g. teams/platform/aws/staging/us_east_1/my_service.</li><li>Push a branch and open a PR.</li><li>Review the plan comment added by Digger and leave feedback.</li></ol><p><strong>What to Expect in Your PR Comments</strong></p><ul><li>The <strong>Digger-Cloud bot</strong> will comment on your pull request with details about the generated projects where it detected code changes. For each affected project, it will share: Status, Action and high-level overview</li><li>Additionally, for each plan, it will post a comment containing the full plan details under a <strong>Plan Output</strong> section.</li><li><em>Bonus feature</em>: Be sure to check out the <strong>Plan Summary, </strong>a concise, easy-to-digest view of what’s changing at the resource level.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EU0mL3a-vvvZfhTy1E6Dcw.png" /></figure><p>4. Apply with digger apply/ Request review.</p><ul><li>You can apply changes to <strong>staging</strong> right away.</li><li>Once validated, copy the changes to the <strong>production path</strong>, commit them, and proceed to: Request a review, Satisfy branch protection rules (Review or whatever you decide), Apply the changes and Merge with confidence.</li></ul><h3>Chapter 7— Keeping Quality High With Pre-commit Hooks</h3><p>Before any commit reaches the repository, it goes through our .pre-commit-config.yaml.</p><p>I won’t go into too much detail and configurations here, but in general, we’re using:</p><ul><li><a href="https://github.com/antonbabenko/pre-commit-terraform"><strong>Anton Babenko Hooks</strong></a> for: formatting, linting and <a href="https://terraform-docs.io/">auto-generating docs</a></li><li><a href="https://trivy.dev/latest/"><strong>Trivy</strong></a> for: secrets and misconfig scanning</li><li><a href="https://github.com/pre-commit/pre-commit-hooks"><strong>Pre-Commit hooks</strong></a><strong> </strong>for: mixed line endings, trailing white spaces and end of file fixer</li></ul><p>These hooks guarantee that:</p><ul><li>Terraform is formatted, validated, and linted.</li><li>Module READMEs stay in sync via tfdocs.</li><li>Trivy blocks commits with vulnerabilities or leaked secrets.</li></ul><p>Install <strong>pre-commit</strong> using your preferred package manager, then run pre-commit installto enable it locally. This ensures that the same checks run automatically <strong>before every push</strong>, giving you consistent guarantees.</p><blockquote>To integrate these checks into your CI, set up a workflow using the <a href="https://github.com/pre-commit/action/"><strong>Pre-Commit GitHub Action</strong></a>. Then, update your <em>digger_workflow.yml</em>to include a validation step ensuring it only runs if the pre-commit checks pass.</blockquote><h4>Example of a fully successful workflow run + pre-commit</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*yCAAy2V2t0PQ8J6jX2neNw.png" /></figure><h3>Bonus — Automatic Module Versioning</h3><p>If you publish reusable Terraform modules inside the same repository, versioning can quickly become a chore. A small GitHub Actions workflow (.github/workflows/module_release.yml) automates semantic version tagging and GitHub releases per module directory.</p><h4>Key points:</h4><ol><li>Scope-aware: it detects which sub-folders under modules/ changed in the last commit.</li><li>Per-module tags: tags are formatted as &lt;module&gt;-v&lt;MAJOR&gt;.&lt;MINOR&gt;.&lt;PATCH&gt; so each module evolves independently.</li><li>Automated release notes: the workflow generates a changelog and provides ready-to-copy usage instructions</li><li>Semantic version bumps:</li></ol><ul><li>BREAKING in a commit message → major version bump.</li><li>feat: prefix → minor version bump.</li><li>Everything else → patch bump.</li></ul><h4>Workflow overview</h4><p>I’ll drop some design for this workflow since this post is getting out of hand but here’s a quick breakdown of what it does:</p><p><strong>Module Release CI/CD Workflow</strong></p><ul><li><strong>Triggers</strong> on merge to main</li><li><strong>Detects</strong> which modules were modified under modules/** in the main branch with <a href="https://github.com/tj-actions/changed-files">changed-files</a> action (supply chain issue was fixed).</li><li><strong>Calculates</strong> the next semantic version tag with <a href="https://github.com/semantic-release/semantic-release">semantic-release</a></li><li><strong>Creates</strong> a new Git tag per module</li><li><strong>Pushes</strong> it to main branch</li><li><strong>Generates</strong> a module-specific changelog and usage snippet</li><li><strong>Publishes</strong> a GitHub release with relevant metadata</li></ul><p>Fully automated, self-contained per module, and production-ready.</p><h4>Example of module release notes and usage is marked</h4><blockquote>I have to come clean, the basic <a href="https://github.com/semantic-release/semantic-release">semantic-release</a> doesn’t provide exactly what in picture, but I’m counting on you that if you got here, you like what you’re doing and you’ll figure out how and whats best for you</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hx4BxKMKykl3KS4V94Gicw.png" /></figure><p>The result: every time you merge to main with changes under modules/, a new version tag and release appear automatically, keeping downstream projects in sync with zero manual effort.</p><h3>Key Takeaways</h3><ul><li>Single S3 backend keeps state consistent and easy to audit.</li><li>GitHub OIDC removes the need for long-lived AWS keys.</li><li>Digger auto-discovers projects, posts plans in PRs, and lets reviewers apply safely.</li><li>Two workflows balance speed in staging with safety in production.</li><li>Pre-commit hooks enforce formatting, docs, and security from day one.</li><li>Model Release bonus</li></ul><p>Add these pieces step-by-step; each stands on its own. Together, they give you a Terraform routine that scales without slowing you down.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47f18803cdd9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/converge-bio/production-ready-terraform-setup-powered-by-digger-ci-cd-47f18803cdd9">Production-Ready Terraform Setup Powered by Digger CI/CD</a> was originally published in <a href="https://medium.com/converge-bio">Converge Bio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serverless at Scale: Moving From Polling to Event-driven Design]]></title>
            <link>https://medium.com/converge-bio/serverless-at-scale-moving-from-polling-to-event-driven-design-d3d9747e332c?source=rss----4b5b6e693482---4</link>
            <guid isPermaLink="false">https://medium.com/p/d3d9747e332c</guid>
            <category><![CDATA[bio]]></category>
            <category><![CDATA[queue]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[serverless-architecture]]></category>
            <category><![CDATA[scale]]></category>
            <dc:creator><![CDATA[Eyal Sol]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 06:18:38 GMT</pubDate>
            <atom:updated>2025-06-11T06:18:38.255Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>How We Efficiently Track SageMaker Inference Events at Scale with AWS Event-driven Architecture</strong></h4><h3>Before We Start — Some Prerequisites</h3><ul><li>Familiar with <em>polling </em>&amp;<em> event-driven</em> concepts</li><li>Interested In Serverless systems</li><li>Interested In AWS SageMaker for Inference tasks</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H0ST7G9W_62yvFpdfWkPKw.png" /><figcaption>Polling vs Event-Driven Architectures</figcaption></figure><h3>Chapter 1 — Introduction: Setting the Stage</h3><p>Our Inference systems are quit simple to explain:</p><p>We have some custom LLM’s we built internally that does biology tasks<br>Each Inference task can take somewhere between 1m -&gt; 15m.<br>Tasks are grouped as a “job” — ranges from a few dozens to hundreds per job.</p><p>We choose AWS SageMaker Async Endpoint as they support:</p><ul><li>“Serverless” manner (scaling to 0)</li><li>Long-running inference tasks (up to 1h)</li></ul><p>It looks something like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INcARGRnm6KYNUl2OALwew.png" /><figcaption>A Simple Inference Flow</figcaption></figure><p>Unfortunately nothing comes easy In the software development world<br><strong>THE THING IS </strong>AWS SageMaker Async Endpoints are <strong>asynchronous</strong>.</p><p>Meaning you don’t get the results immediately as It can take time — SageMaker does the following:</p><ul><li>managed queue for tasks before being processed</li><li>“puts” a success/failure file(s) In S3 once finished</li><li>(<strong>optional</strong>) sends an event of the inference event</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xTyFuYWkKj1cqxQsEVYqYg.png" /><figcaption>Results Are Saved &amp; Notification Sent</figcaption></figure><p>Initially our “naive” solution was a simple <em>polling</em> logic every x minutes<br>Checking if a success/failure file was created by SageMaker.</p><p>Based on a file existence or not — we knew what inference event(s) succeeded/failed and updated their corresponding job status:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M5GoO_EAkYtLjgG8dzuu5g.png" /><figcaption>Yep .. That Simple</figcaption></figure><p>Unfortunately, the Implementation by the AWS SageMaker team has edge-cases — It’s doesn’t create a “failure” file for the following scenarios:</p><ul><li>Events timing out within AWS <em>managed queue </em>of user requests</li><li>Didn’t finish processing within timeout limit (e.g max 1h)</li></ul><p>This left us BLIND for some rare yet trivial edge-cases causing us:</p><ul><li>couldn’t find a success/failure file</li><li>couldn’t understand the outcome of an inference task</li><li>couldn’t decide if a job was finished</li></ul><p>This was the moment we understood we needed an architecture change.</p><h3>Chapter 2: Discovering a Better Way (Event-driven Architecture)</h3><p>As I mentioned before — when SageMaker finishes processing an inference event, It can send an event to AWS SNS with a quick summary.<br>Basically summarizing “how it went”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVP3RfghGBEDPKLPg29RHA.png" /></figure><p>That’s when we knew polling had to go, and event-driven architecture was the way forward — even if it meant added complexity</p><p>But what does it actually means ?</p><ul><li>Processing events from a publisher (e.g SageMaker Async Endpoint)</li><li>Sending them to AWS SQS to get more reliability &amp; decoupling</li><li>Matching between inference events to their job</li><li>Updating a job status based on It’s inference events results</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v90j3ycd3C8Ilw5-diRUQg.png" /></figure><h3>Chapter 3: Results That Made the Effort Worth It</h3><p>We decided to take this “new architecture” for a ride:<br>We ran a massive experiment at 6–8x times bigger load compared to day2day jobs</p><p>Results were .. <strong>GREAT</strong></p><ul><li>0 inference events “lost” (timeouts/prcoessing errors/x)</li><li>all jobs finished “successfully” (beside one that <strong>should’ve</strong> timed out)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LmSfn7mDgNUwjP4Ho2H3Dw.png" /></figure><h3>Conclusion: Lessons Learned and Moving Forward</h3><p>We feel we learned A LOT as a team from this experience</p><ul><li>Starting small with an easy, naive solution can take you a long way</li><li>A simple, naive solution can take you so far — sometimes a rethink is necessary</li><li>Serverless tools can do a lot of heavy-lifting for you (storing events, managing retries and logging)</li></ul><h4>Note there are some “hidden gems” I want to point out</h4><ol><li>Lambda <a href="https://docs.aws.amazon.com/lambda/latest/dg/services-sqs-errorhandling.html#services-sqs-batchfailurereporting">“partial batch responses”</a></li></ol><ul><li>remember using “best practices” with It such as <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html">dead-letter queue</a> and <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.html">maxReceiveCount</a></li></ul><p>2. Using <a href="https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html">Step Function</a> to coordinate system the entire process</p><ul><li>Didn’t mention It enough — see <a href="https://medium.com/converge-bio/making-open-source-work-how-we-built-a-practical-internal-tool-58e54ca9f7ec">THIS</a> for some reference</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3d9747e332c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/converge-bio/serverless-at-scale-moving-from-polling-to-event-driven-design-d3d9747e332c">Serverless at Scale: Moving From Polling to Event-driven Design</a> was originally published in <a href="https://medium.com/converge-bio">Converge Bio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices Are Awesome… Until They Aren’t]]></title>
            <link>https://medium.com/converge-bio/microservices-are-awesome-until-they-arent-53fc8cf33b08?source=rss----4b5b6e693482---4</link>
            <guid isPermaLink="false">https://medium.com/p/53fc8cf33b08</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[job-security]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[complexity]]></category>
            <dc:creator><![CDATA[Eyal Sol]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 05:27:10 GMT</pubDate>
            <atom:updated>2025-04-02T05:27:09.920Z</atom:updated>
            <content:encoded><![CDATA[<p>Following engineering trends Is fun, until you need to open 5 different IDE’s tabs for 7 different Git Repositories just to add a small feature.</p><p><strong>Sounds familiar? You’re not alone.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YK2SBlyNOLjvSl1lnaRf5w.png" /><figcaption>Good-old Monolith vs Shiny Microservices Architectures</figcaption></figure><h3>What We’ll Cover</h3><ul><li>Why <em>microservices</em> Might Be Harmful For Your R&amp;D Team</li><li>What Are The Alternatives (sneak peak .. “The Modulith”)</li><li>What Can You Change Right Now</li></ul><h3>Introduction</h3><p>As a DevOps engineer, I’ve worked in companies that aimed to keep engineering standards high — meaning clean codebases, clear documentation, stable APIs, and infrastructure that doesn’t wake you up at night.</p><p>But there’s one problem I’ve seen everywhere: <strong>Complexity creep</strong>.</p><p>No matter how good your intentions are, if your architecture is overly complicated, your engineering standards quickly go from “high” to “help!”</p><p><strong>The road to hell is paved with good intentions</strong></p><h3><strong>How We Got Here ?</strong></h3><p>Good question.</p><p>For me, <strong>“here”</strong> means adopting microservices prematurely — without a genuine technical need, like significant complexity, huge codebases, or real scalability needs. Too often, we chase trends or imitate big companies, introducing excessive tooling and complexity just to deliver simple features.</p><p>In other words:</p><p>It’s like taking a private jet for a trip around the block.</p><h3><strong>🚧 Main Message: Avoiding Premature Optimization in Your Architecture</strong></h3><p>As engineers, we’re constantly told to plan ahead — to anticipate scale, future-proof our code, and build infrastructure that’s <em>“enterprise-ready” </em>from day one.</p><p>But premature optimization, especially in architecture, often creates more problems than it solves.</p><p>Adopting microservices too early is a classic example:<br>A <strong>solution looking for a problem</strong>, creating complexity without a real need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*y2RZu3nR4ZudqBg0g3zNaw.jpeg" /><figcaption>It Happens to the Best of Us…</figcaption></figure><h3><strong>How Premature Microservices Create Unnecessary Complexity</strong></h3><ol><li><strong>Distributed Monolith: Kubernetes Traffic Jam</strong></li></ol><p>You start with good intentions: <strong>‘Let’s split the monolith into clean services.’<br></strong>But soon, your Slack is full of:</p><p>🔹 <em>‘Is Service A deployed yet? Service B is waiting…’</em></p><p>CI/CD pipelines slow down. <br>A simple feature becomes a multi-team, multi-week marathon, clogging your workflow with endless dependencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*n5fvvn_jaFlHtViKTWnnTw.png" /><figcaption><em>Microservices Spaghetti At Scale</em></figcaption></figure><p><strong>2. Operational Overhead: DevOps Tool Overload</strong></p><p>You planned a simple REST API, but now you’re buried in Helm charts, Kubernetes YAMLs, Istio sidecars, and Prometheus alerts. <br>Instead of shipping features, you’re debugging Argo CD at midnight and updating Grafana dashboards, trading velocity for unnecessary complexity.</p><p><strong>3. Persistent Technical Debt: APIs Become PagerDuty Alerts</strong></p><p>A minor change unexpectedly breaks an API, and suddenly you’re awake at midnight, frantically scrolling Datadog logs to trace cascading failures. Premature microservices multiply API contracts and introduce versioning nightmares, leaving your team trapped in constant firefighting mode.</p><h3><strong>Proposed Solutions: Keep it Simple (Until You Can’t)</strong></h3><p><strong>1. Modulith: Clear Boundaries, Without the Microservice Overhead</strong></p><p>A <em>Modulith</em> (modular monolith) gives you clear internal boundaries and modularity, without network complexity or operational overload.</p><p>It structures the application(s) into well-defined modules, each with strict API contracts — This approach maintains a single deployable unit, making development, testing, and refactoring more efficient while still allowing for gradual evolution into independent services when truly needed.</p><p>While it can have some tricky parts — like managing shared databases or enforcing boundaries — careful structuring (packages, namespaces, build tools) will set you up to scale later.</p><p><a href="https://newsletter.fractionalarchitect.io/p/20-modular-monolith-various-ways">This Fractional Architect article</a> covers practical ways to handle these challenges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*LBQ3qzHLls5NiWlnlxWWFQ.png" /><figcaption>A Sneak-Peak Into A Modulith Architecture</figcaption></figure><p><strong>2. Managed Orchestration: Skip Kubernetes Until You Really Need It</strong></p><p>You don’t need Kubernetes just because you’re containerizing your monolith or Modulith.</p><p>Consider <strong>simpler managed platforms</strong> instead:</p><p><strong>• AWS ECS/Fargate<br>• Google Cloud Run<br>• Azure Container Instances</strong></p><p>These tools eliminate operational headaches, letting your team deliver features without managing complex infrastructure.</p><h3><strong>Wrapping Up: 🔑 Key Takeaways</strong></h3><p>• <strong>Avoid Premature Optimization:<br></strong>Don’t chase trends. Choose simplicity until complexity is truly needed.</p><p>• <strong>Modulith First:<br></strong>Start modular within your monolith, allowing your architecture to evolve naturally.</p><p>• <strong>Delay Kubernetes Complexity:<br></strong>Managed solutions (<strong>AWS ECS</strong>, <strong>App Runner</strong>, <strong>Cloud Run</strong>) provide scalability without operational overhead.</p><h3><strong>What’s Next?</strong></h3><p>Take an honest look at your current architecture: Are you solving real problems, or chasing popular solutions?</p><p>Start small, grow intentionally, and scale your architecture based on genuine needs — not trends.</p><p>Your engineering team (and your future self) will thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53fc8cf33b08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/converge-bio/microservices-are-awesome-until-they-arent-53fc8cf33b08">Microservices Are Awesome… Until They Aren’t</a> was originally published in <a href="https://medium.com/converge-bio">Converge Bio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Open Source Work: How We Built a Practical Internal Tool]]></title>
            <link>https://medium.com/converge-bio/making-open-source-work-how-we-built-a-practical-internal-tool-58e54ca9f7ec?source=rss----4b5b6e693482---4</link>
            <guid isPermaLink="false">https://medium.com/p/58e54ca9f7ec</guid>
            <category><![CDATA[bioinformatics]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Eyal Sol]]></dc:creator>
            <pubDate>Tue, 07 Jan 2025 06:20:31 GMT</pubDate>
            <atom:updated>2025-01-07T06:20:31.778Z</atom:updated>
            <content:encoded><![CDATA[<p>How we took <em>Boltz-1</em>, a public open-source model, and built internal tools around it to deliver real value for our bioinformatics teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*INoFDIlzrLdaqip_jFfL-g.png" /><figcaption>Boltz-1 prediction on a protein small-molecule complex.</figcaption></figure><h3><em>Introduction</em></h3><p>As an engineer without a biological background, seeing how Boltz-1 works was fascinating — from a raw sequence to an actual 3D representation.<br>Comparing it to other tools like AlphaFold2 is like night and day:</p><ul><li>Super easy to set up and use.</li><li>Excellent documentation and a supportive community.</li></ul><p>But there’s a gap between running it locally for a few samples and having a <strong>production-ready solution</strong> — one that scales, requires no setup for the end user, and “just works”.</p><p>So, this is how we started: with a great open-source model we wanted to include in our company’s toolbox, keeping a few key considerations in mind:</p><ul><li>It had to be <strong>simple</strong> for the end user.</li><li>It had to be <strong>cost-efficient</strong> (or at least not too expensive).</li><li>It had to be hosted on our <strong>company cloud infrastructure</strong>.</li></ul><h3>Solution Overview</h3><p>As mentioned earlier, we wanted an easy-to-use solution that requires no setup from the end user. The idea was to let users “trigger a job and forget about it,” receiving results via email or Slack when the process was complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*JdLsGi0IGwSKrKbKf_6iag.png" /></figure><p>Also, we want our solution to be based on AWS offering, we decided to go with the following AWS services</p><p><strong>Inference layer — SageMaker</strong></p><ul><li><em>SageMaker Endpoint<br></em>Takes our customized <em>Boltz-1</em> model container Image, which Includes Inference logic based on <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/adapt-inference-container.html">AWS requirements</a>.</li></ul><p><strong>Orchestration layer — StepFunction &amp; Lambda</strong></p><ul><li>StepFunction <br>A workflow orchestrating the entire flow, from processing user Inputs, Invoking SageMaker Endpoint to sending results once finished</li><li>Lambda(s)<br>The actual part which does the “heavy lifting” — I’ll deep dive Into each lambda responsibility right away</li></ul><p><strong>State layer — S3 bucket</strong></p><ul><li>S3<br>Used to store state of each job by a file namedstate.json, this file Is being checked &amp; updated between steps.<br>Every jobs a user triggers get’s Its own state file<br>e.g /jobs/&lt;job_name&gt;/state.json</li></ul><h3>How does the architecture look ?</h3><p>Personally I find It hard understanding these kind of workflow without seeing a visual representation of it<br>Here’s a simplified version of the entire workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TmEbdu4Jc5wt6ypkOXPNDw.png" /></figure><p>Let’s go over what happens from the moment a Bioinformaticians wants to generate a structure for a random protein sequence<br>It goes as follows</p><ol><li><strong>User Input:</strong></li></ol><p>A bioinformatician uses a <em>helper scripts</em> to invoke a Step Function workflow with the following inputs:</p><ul><li>list of key-value pairs (e.g. &quot;&lt;id&gt;”:”&lt;raw_sequence&gt;”).</li><li>The user’s Slack email.</li><li>A job name (e.g. &quot;please_work&quot;).</li></ul><p>2. The <em>StepFunction</em> workflow facilitates the entire flow &amp; handling failures</p><ul><li><strong>Lambda-1 </strong>Is responsible for the following<br>- It process the raw sequence and save It to a valid state.json file In S3<br>- Invokes SageMaker async endpoint using .json as Input file<br>- Create a status.json file which holds the job entire status, process status for each sequence such as S3 Input path (.json file) and the SageMaker endpoint output response and other metadata.</li><li><strong>Lambda-2</strong> checks every 5 minutes If there Is a change In the job status<br>Once all sequences were processed successfully/unsuccessfully<br>It reads the status of job/each sequence from status.json file and updates It If needed.</li><li><strong>Lambda-3</strong> gathers all results, zips them and sends as DM to requester by <em>Slack</em><br>It checks which succeeded/failed and format the message accordingly.</li><li><strong>Lambda-4 </strong>handles all cases of failures within within the StepFunction workflow, notify user via Slack.</li></ul><p>A successful result would looks like so<br>(A screenshot of Slack DM containing results)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*grfDuPSWzYwS8HX7ToqWIQ.png" /></figure><h3>Some honorable mentions</h3><p>I must mentions some Implementation details which made this setup super easy to use, setup and debug</p><ul><li><strong>StepFunction workflow</strong><br>Configuring one place where everything Is “connected” made It much easier to understand the data flow between steps and also debug It when something breaks<br><strong>Highly recommended !</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*5-f6oD5zKfLzRUrNj46YWg.png" /></figure><ul><li><strong>SageMaker Endpoint<br></strong>Handles everything from serving the model for Inference, to scaling down when there are more no requests<br>Would recommend lookin at <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/async-inference.html">SageMaker Async Endpoint configuration</a> with <em>autoscaling</em> for scaling up/down based on usage<br><strong>Highly recommended !</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgrUWqU3zmyMwps5xazR4A.png" /><figcaption>Our Implementation of SageMaker <em>Endpoint A</em>utoscaling.</figcaption></figure><ul><li>Using S3 to store state<br>Instead of using Step Functions’ internal state mechanism, we opted to store a “state” file in S3 for better traceability and auditability.<br>With S3, it was straightforward to locate the status.json file for each job based on its folder structure (e.g. /jobs/&lt;job_name&gt;/state.json )<br>This approach allowed us to easily track job statuses and debug issues.<br><strong>Highly recommended !</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*00OWcpgHKqQ1Gy7nweg0wQ.png" /><figcaption>jobs/random_id/status.json</figcaption></figure><h3>Key Takeaways</h3><p>What do I take from here ?<br>That open source models are great, but building the right tooling around them Is necessary to make It useable at scale</p><p>This was our “first rodeo” building such a pipeline around open source models, and we learned a lot along the way ..</p><p>Would love to hear your thoughts !</p><p>(BTW — the company I work for is called <a href="https://converge-bio.com/">ConvergeBio</a> .. check us out !)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58e54ca9f7ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/converge-bio/making-open-source-work-how-we-built-a-practical-internal-tool-58e54ca9f7ec">Making Open Source Work: How We Built a Practical Internal Tool</a> was originally published in <a href="https://medium.com/converge-bio">Converge Bio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Large Biological Models (LBMs) part 0: intro for non-biologists]]></title>
            <link>https://medium.com/converge-bio/large-biological-models-lbms-part-0-intro-for-non-biologists-d6ac474d7418?source=rss----4b5b6e693482---4</link>
            <guid isPermaLink="false">https://medium.com/p/d6ac474d7418</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[biology]]></category>
            <dc:creator><![CDATA[Oded Kalev]]></dc:creator>
            <pubDate>Sun, 20 Oct 2024 14:01:12 GMT</pubDate>
            <atom:updated>2024-08-29T15:11:36.572Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the first part of my series on Large Biological Models (LBM). It is an introduction that will allow readers without biological background to follow the series.</p><p>I’ll go through the most common biologic data: DNA, RNA, Proteins, Bulk/SC RNA sequencing and small molecules, after understanding how biological data is represented digitally we’ll be able to delve deeper into how key research questions are tackled using ML.</p><p>In this series, we’ll dive deep into the computational techniques that are revolutionizing the way we understand and manipulate biological data.</p><h4><strong>DNA</strong></h4><p>DNA (Deoxyribonucleic Acid) is the molecule that carries the <a href="https://www.genome.gov/genetics-glossary/Gene#:~:text=Definition,differing%20functions%20within%20the%20body.">genetic</a> instructions for life, it is made up of sequences of smaller molecules called nucleotides, and is often referred to as the “blueprint” of an organism, it is found in the nucleus of cells in most living organisms, including humans, plants, and animals.</p><p>In DNA, there are four types of nucleotides, which are called bases: Adenine (A), Thymine (T), Cytosine (C), and Guanine (G)</p><p>DNA is mostly double stranded, meaning that each base has a pair A-T and C-G, and the genome length is the amount of base pairs (BP).</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*Jxn3AOeiQyEZ7bqp.png" /></figure><p>DNA sequencing means determining the order of nucleotides in a DNA molecule. The first DNA sequencing method was invented in 1977 (Sanger sequencing) and became widely used in the 1980s, since then new methods were developed making sequencing cheaper and more common.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*3E7nE3d8f9Te5PIK.png" /></figure><p>To give a sense on the sheer size and amount of information in a single <a href="https://www.genome.gov/genetics-glossary/Genome#:~:text=The%20genome%20is%20the%20entire,chromosome%20in%20the%20cell&#39;s%20mitochondria.">Genome</a>, a Human genome consists of 3.2 billion BP A Mouse genome 2.7 billion BP, Onion genome 16 billion BP, Salmon genome 3 billion BP, Ant 350 million BP.</p><p>The size of an organism’s genome is influenced by a variety of factors, including the amount of non-coding DNA, the presence of repetitive sequences, the occurrence of genome duplications, and the specific evolutionary history of the species. This explains why some organisms, like onions, have much larger genomes than others, like humans or mice, despite not being more complex.</p><h4><strong>RNA</strong></h4><p>RNA (Ribonucleic Acid) is a molecule that helps convert the genetic information in DNA into proteins, it acts as a messenger carrying instructions from DNA to the cell’s protein-making machinery among other roles.</p><p>It is found throughout the cell, particularly in the cytoplasm, where it directs protein synthesis.</p><p>RNA is made up of the same nucleotides as DNA except Thymine (T) is replaced by Uracil (U), its also mostly single stranded, making us measure its length in bases instead of base pairs.</p><p>RNA sequencing (RNA-Seq) similarly to DNA sequencing, means determining the order of nucleotides in an RNA molecule, it was developed around 2008 and quickly became a standard tool in gene expression studies.</p><p>RNA is much shorter then DNA, an RNA based drug such as Patisiran is 21 bases long, Covid RNA vaccine is ~4000 bases long, CRISPR-Cas9 is ~1000, Viral RNA such as Covid is ~30000 bases long.</p><p>Short RNA Typically involved in precise, quick regulatory functions or in supporting roles in larger molecular processes while long RNA often serve as templates for protein synthesis or have complex regulatory or structural roles. Their length allows them to carry extensive information or interact with multiple molecules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*_qFN4AFpJ56Qwom2" /></figure><p><strong>Bulk/Single-Cell RNA-Seq</strong></p><p>Both methods are meant to give us the de facto expression (amount produced) of RNA in a population of cells and in single cells (as the name implies). In Bulk RNA seq The RNA is mixed together, and the resulting sequence data represents an average expression level across all the cells in the sample, while Single-cell RNA sequencing (scRNA-Seq) is a technique that sequences the RNA from individual cells instead of averaging the expression over an entire sample.</p><p>Bulk RNA-Seq became widely used around 2008, following the advent of next-generation sequencing (NGS) technologies that made it possible to sequence large amounts of RNA quickly and cost-effectively.</p><p>scRNA-Seq was first developed and published around 2009–2011, with major advancements in technology occurring in the early 2010s. It has since become a crucial tool in genomics research.</p><p>An ‘atlas’ defines the genes measured in bulk/sc RNA Seq, and its size differs greatly, normally 22,000 genes are measured.</p><p>Each gene is represented by a column, and each sample by a row, making it tabular data with the number of columns and rows depending on the amount of data sequenced and the atlas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*yldILM_fAl_hwdn2" /><figcaption>Bulk vs Single Cell RNA seq</figcaption></figure><p><strong>Proteins</strong></p><p>Proteins are found in every part of the cell and throughout the body, performing many essential functions.</p><p>Proteins are large, complex molecules that perform many of the functions in a cell, including building structures, driving chemical reactions, and signaling between cells, they are made from sequences of amino acids.</p><p>There are 20 different common amino acids found in known living organisms, and each one is represented by a unique single-letter code.</p><p>Protein sequencing means determining the order of amino acids in a protein, which can be done using techniques like mass spectrometry. Protein sequencing began in the 1950s, with methods becoming more advanced and widely used over subsequent decades.</p><p>Protein lengths are similar to RNA, most protein sequences are composed by 100–400 amino acids, small proteins, or peptides can consist of fewer than 100 amino acids (like insulin which is composed of 51 amino acids) while long proteins can consist of more than 500 amino acids, one of the largest known proteins, Titin is composed of 30,000 amino acids.</p><p>The length of a protein often correlates with its function. Shorter proteins might act as signaling molecules or enzymes, while longer proteins often have structural roles or complex, multi-domain functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*K6EnY9qcuU_HfhHB.png" /><figcaption>From DNA instruction to Protein</figcaption></figure><p>The amino acid sequence is called the primary structure of the protein, but physically throughout its synthesis the protein goes through a chemical process called folding until it reaches a stable, three dimensional structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/0*Q3Kktj1RgeD7Jdr_.png" /><figcaption>Folding process of a Protein</figcaption></figure><p><strong>Small molecules</strong></p><p>So far we discussed DNA, RNA and Protein, which are all very large and heavy molecules with a repetitive nature, a huge amount of processes in nature and in the human body specifically are driven by smaller molecules, these chemicals are commonly represented using some variation of SMILES (Simplified Molecular Input Line Entry System) which allows encoding molecular structures as text strings where atoms, bonds, branches, and rings are represented as textual symbols, it was invented in the late 1980s by Arthur Weininger and David Weininger.</p><p>This is the shortest sequence we discussed about, a short molecule can be a few characters long, and a long one can be hundreds of characters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*dk7uXF7tSMecABWM.png" /><figcaption>Example of Smiles notation for Ciprofloxacin</figcaption></figure><p>Now that we know how biological data is represented and what it means, in the next part of the series we’ll dive deep into the first steps of preprocessing and tokenizing the data for LBMs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6ac474d7418" width="1" height="1" alt=""><hr><p><a href="https://medium.com/converge-bio/large-biological-models-lbms-part-0-intro-for-non-biologists-d6ac474d7418">Large Biological Models (LBMs) part 0: intro for non-biologists</a> was originally published in <a href="https://medium.com/converge-bio">Converge Bio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>