<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Travis Webb on Medium]]></title>
        <description><![CDATA[Stories by Travis Webb on Medium]]></description>
        <link>https://medium.com/@tjwebb?source=rss-7e8a33dc1bc0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vSPIEgnbnr5f9GzN.png</url>
            <title>Stories by Travis Webb on Medium</title>
            <link>https://medium.com/@tjwebb?source=rss-7e8a33dc1bc0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:42:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tjwebb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Is Gen AI the killer app, or the final boss?]]></title>
            <link>https://tjwebb.medium.com/is-gen-ai-the-killer-app-or-the-final-boss-778bc7f5dd17?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/778bc7f5dd17</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 18:59:30 GMT</pubDate>
            <atom:updated>2024-11-16T18:59:30.704Z</atom:updated>
            <content:encoded><![CDATA[<h4>Big implications for the future of the Cloud game</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*XYDbVN4KkgKh8jsz.png" /></figure><h3>Back in the day</h3><p>In the 1990s and early 2000s, the only way to deploy an individual server to run business workloads was to buy a machine and ship it to a colocation or “colo” facility, which was usually used to fill extra space in a datacenter not yet at full capacity. When virtualization became more popular and viable in the mid-2000s with the rise of multi-core CPUs, businesses could rent Virtual Private Servers, or VPSs, which were used to fill extra space on individual servers not yet at fully capacity.</p><p>When the first Cloud providers appeared in the late 2000s, they offered VPS at a scale not seen before, referred to now simply as VMs or Virtual Machines, along with ancillary hosted services such as queuing systems (e.g. AWS SQS) and managed application hosting services (e.g. Google App Engine). The relative ease of spinning up a VM in comparison to buying a server and installing it into some datacenter rack somewhere and having to constantly replace failed hard drives was cloud’s original “killer app”.</p><blockquote>At the end of the day, everything in IT is either an application, a database, or a conduit to move data between the two.</blockquote><p>The three “hyperscalers”, as they humbly refer to themselves — Microsoft Azure, Google Cloud, and Amazon Web Services — have been playing this same basic game for the past 15 years. Virtual Machines (VMs) have continued as the core offering from all three cloud providers, around which an ever-growing repertoire of additional services are offered. Some of these services such as managed databases and load balancers can replace workloads that formerly ran on VMs, and others such as machine learning and global messaging systems (e.g. SQS, PubSub) are entirely new kinds of services that scale beyond the capacity of any single VM, or even large groups of VMs.</p><p>For each cloud provider, something like three-quarters of revenue still comes from selling VMs, which remain substantially similar in form to the VPS offerings two decades earlier. VMs, however, are among the lowest margin services offered by cloud providers. It’s difficult to differentiate one VPS service from another, especially considering that the underlying machines all rely on the same Intel, AMD, and Nvidia chips and related components, and so much of the competition between providers occurs in the realm of ancillary services. None of the providers are buying billboards boasting about how their VMs are 1.8% faster than somebody else’s VMs, because nobody cares. The “Intel Inside” days where one computer was 40% faster than somebody else’s computer are over for good.</p><h3>What’s next?</h3><p>What cloud customers do care about is getting access to new information technology that they don’t currently have to solve problems they can’t currently solve, and just about all new tech is made available through cloud computing platforms. But how much new tech can possibly be built? The providers have invested stupendous resources building everything from custom databases e.g. Google BigQuery, to managed open-source data pipelines e.g. AWS Managed Flink, to low-code business process orchestrators, e.g. Azure Logic Apps. But in the past few years, it’s clear that the three providers are homogenizing in all dimensions.</p><p>If you’re a cloud provider, you want to differentiate, but you don’t want to be so different that nobody understands what you’re doing. Providers are increasingly building and releasing services that already exist on other cloud platforms, precisely for that reason: if my competitor has one, I’d better have it too, and I should be compatible with their service so that I can steal their customers away more easily. No cloud provider wants to be the Betamax of the cloud business — they’ll be better off selling VCRs than trying to invent a new paradigm before the current one has run its course. This isn’t to say that the Cloud market is hurting for new areas of growth, because the cloud computing model is still very in-demand by IT customers. And it takes time for corporate datacenter leases to run out, and so there’s still a lot of migration yet to happen. But the space to offer totally novel services is running out. At the end of the day, everything in IT is either an application, a database, or a conduit to move data between the two. There are only so many things you need to make to support and enable these basic building blocks.</p><p>One of the reasons cloud providers love building ancillary services is because they offer higher margins than the core VM offering, and they often drag in other related workloads with them. If a business is going to move a terabyte of data into BigQuery or AWS Redshift, it doesn’t make sense for the workloads that utilize that data to remain in a corporate datacenter a thousand miles away. It’s like taking a new job in a new city, but staying in your current house and commuting four hours a day to work. Maybe you suck it up for awhile, but eventually your house is going to end up closer to your job, one way or the other. Likewise, the cloud providers know that if they get your data, other workloads will follow. This is known in the industry as “data gravity”.</p><p>But what’s next? Serious practitioners of machine learning used to insist that it was not correct to refer to ML as AI, or artificial intelligence. AI was a term used only by uninitiated dilettantes. Nonetheless, all three providers now proclaim their supremacy in the field of Generative AI, not Generative ML.</p><p>Machine learning workloads have long been the holy grail for cloud providers because of the immense amount of proximate data required to train them, and the large compute cost of training and inference and re-training, which cost is passed onto customers with a little extra margin thrown in. Not only does storing data cost money, but beyond a certain critical mass it becomes very difficult and risky to move that data somewhere else later. But cloud providers have hitherto struggled to get customers to use their AI services for much beyond occasional experimentation, and stuff that most people still do in Excel: ad targeting, sales forecasting, customer churn prediction, and so forth. Now, they say, Gen AI has come to the rescue.</p><h3>Technical debt</h3><p>A large organization cannot wake up one morning and suddenly decide to be innovative. A company’s IT position is like your brand, your distribution network, or any other capital asset — it represents the sum total of all technology investment over the life of your company. In the same way that postponing maintenance on critical machinery in a factory merely delays the day of reckoning (and can juice your stated financial results in the meantime), under-investment in a company’s IT systems accrues “technical debt”. And like factory machinery, delaying the problem only makes it worse when the bill finally comes due. This is part of the basic strategy of private equity, which is notorious for delaying capital expenditures so that the results look great on paper, and the future costs of maintenance and asset replacement are hidden. And indeed, many firms that exit PE ownership find themselves with immense levels of technical debt, which only herculean efforts and expense can undo.</p><p>Unfortunately for technically-indebted companies, effectively utilizing cloud ML services requires not only sophisticated technical staff, but it requires a well-situated, well-designed, modernized IT infrastructure that many companies do not possess. It doesn’t matter how innovative you feel, you cannot Leroy Jenkins your way straight from twenty-year-old tech and into the full benefits of Gen AI. And there is a lot of old tech still sitting at the heart of corporate IT. This applies especially to companies that say things like “we are a technology company that just happens to sell insurance” — these are the same companies who have a mission-critical Oracle database that crashes every Tuesday and nobody can quite figure out why.</p><p>Dragging in other workloads that are related to new Gen AI investment is likely the next big driver of growth for the cloud providers, moreso than direct spend on Gen AI services directly. Microsoft tip-toed around this idea in their Q1 2024 earnings call, saying that 6% of revenue growth was tied to Gen AI-related workloads. Notably, they did not cite the direct spend on AI services themselves. There is an argument to be made that if Gen AI can’t convince a company to go all-in to the cloud, nothing will.</p><h3>The hype is real</h3><p>In any case, companies are now scrambling to take advantage of the supposedly revelatory power of generative AI. Google botched their initial foray into the space by pioneering it and then pretending that it didn’t exist. Microsoft is “investing” billions of dollars into Open AI which mainly consists of Azure credits. Amazon is doing what they do best: waiting for customers to pound the table and then building <a href="https://www.youtube.com/watch?v=BtJAsvJOlhM">whatever products they ask for</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*p6R2sb_uL769L92z.png" /></figure><p>For the cloud providers, Gen AI may be an opportunity to build up more data gravity and finally tap into workloads that are still sitting in corporate data centers, or at second-tier providers such as IBM and Oracle Cloud that haven’t yet caught up to the hyperscalers in this area. But it’s not really a new thing, in the sense that the three big providers have had machine learning services for years. Gen AI appears to be a new service within these existing suites, rather than a totally new area of expansion.</p><p>It remains unclear whether Gen AI will deliver on the benefits ascribed to it by its proponents, which seem to be just about everyone these days. It would make a lot of sense if Gen AI were actually sentient, because that would explain how every media organization in the world is working in perfect harmony to advertise its new-paradigm powers. If it does deliver, I wonder what the next thing will be for the cloud providers. Maybe Gen AI really is the beginning of a new wave of further consolidation of workloads into central computing platforms. I think it more likely that Gen AI represents the final boss — the opposite of the killer app which spawns new platforms, and more like the final piece that completes a puzzle.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=778bc7f5dd17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Fatal Flaw of the Norfolk Sea Wall]]></title>
            <link>https://tjwebb.medium.com/the-fatal-flaw-of-the-norfolk-sea-wall-e076f7080917?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e076f7080917</guid>
            <category><![CDATA[climate-change]]></category>
            <category><![CDATA[flooding]]></category>
            <category><![CDATA[norfolk]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 03:39:14 GMT</pubDate>
            <atom:updated>2024-11-17T07:27:01.264Z</atom:updated>
            <content:encoded><![CDATA[<h4>How one man-made disaster has led to another</h4><p>(I wrote this in Feb 2023 but did not publish it. I think it is still correct, and decided to publish now.)</p><blockquote>An infrastructure project that claims to protect the city from growing threats far into the future is cursed with a glaring flaw. Neither the <a href="https://usace.contentdm.oclc.org/digital/api/collection/p16021coll7/id/6232/download">official study nor any of the peer review comments</a> mention this problem.</blockquote><h3>Surfing the Potomac Aquifer</h3><p>Aside from being home to the world’s largest Naval base, Norfolk, Virginia is a typical old-money east coast city. It has an average elevation of around ten feet, experiences occasional flooding, and the <a href="https://www.washingtonpost.com/magazine/2020/04/13/after-decades-waterfront-living-climate-change-is-forcing-communities-plan-their-retreat-coasts/">Washington Post in particular</a> appears obsessed with making it into an example of what Hurricane Katrina could have done if it had hit the east coast.</p><p>Norfolk is suffering rapid <em>relative</em> sea level rise due to an increase in the oceans’ water mass as well as land subsidence. Both of these factors are due to a known bug in modern free enterprise society: a chronic failure to account properly for time-delayed externalities.</p><p><strong>The first reason</strong> — the expansion of the oceans’ water mass — is widely studied and reported on. It appears to be caused mainly by pumping more CO2 into the atmosphere than terrestrial ecosystems can absorb. It sure looks like this excess carbon is heating up the atmosphere and the oceans. This supposedly causes larger storms, and therefore larger storm surge. Coastal cities like Norfolk are particularly vulnerable to storm surge.</p><p>Let’s say you want to solve this problem once and for all. You might conjure up a plan for <a href="https://www.resilientnorfolk.com/">an enormous $2.6 billion sea wall</a> that surrounds the city. If storm surge is the enemy, a wall is the cure.</p><p><strong>The second reason — </strong><em>relative </em>sea level rise is where sinking land has the same effect as a rising ocean. The USGS estimates that approximately half Norfolk’s relative sea level rise is due to land subsidence. Norfolk and the surrounding area sit on top of the Potomac aquifer, which is far below the surface, and several hundred feet in vertical height. This aquifer is being depleted. As water is drawn from it, its vertical height shrinks much like a deflating balloon, taking the relative elevation of the surface down with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zUMPcd068nigLB_V.png" /><figcaption>Cones of depression form underground when water is pumped out of an aquifer at a rate that exceeds its natural replenishment, pulling down the surface</figcaption></figure><p>The city itself and the proposed sea wall share the very same surface: the one sitting on top of the Potomac Aquifer. This leads to an inescapable conclusion: unless we stop draining the aquifer, the proposed wall will be at its highest and most effective on the day construction is complete. It will begin sinking along with everything else. An infrastructure project that claims to protect the city from growing threats far into the future is cursed with a glaring flaw. Neither the <a href="https://usace.contentdm.oclc.org/digital/api/collection/p16021coll7/id/6232/download">official study nor any of the peer review comments</a> mention this problem.</p><p>The wall is primarily designed to protect against storm surge, where height and strength really matter a lot. (It does not address fluvial or pluvial flooding, and might actually make those modes of flooding <em>worse</em>, but I will not get into that for this article).</p><p>At the same time as external threats from the sea are projected to grow, the wall will become less effective. The threat under our feet remains wholly unaddressed, and continues to grow.</p><h3>International Paper</h3><p>The depletion of the Potomac Aquifer is not a natural phenomenon. Much like the warming oceans, it is an invisible disaster of our own creation.</p><p>​​Two pulp and paper mills — one owned by WestRock in West Point, VA, and the other owned by International Paper in Franklin, VA — account for substantially all of the aquifer’s depletion over the past several decades. Their extractions form dual <a href="https://wellwater.oregonstate.edu/groundwater/understanding-groundwater/groundwater-and-wells">cones of depression</a> which drags down the surrounding land. The same thing is happening in <a href="https://blogs.agu.org/geospace/2019/03/19/western-droughts-caused-permanent-loss-to-major-california-groundwater-source/">California’s Central Valley Aquifer</a>, which much of the media hastens to blame on “climate change”, but the main problem is the relentless pumping of water from the aquifer below the surface. Of all the cities in this area, Norfolk is situated uniquely and terribly in geoproximity to both the ocean and the Franklin Paper Mill.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ygm_vkMwbzpFk838.png" /><figcaption>Projected 2050 Potomac Aquifer Water Levels, Feet Change. Franklin, VA showing a 200 ft. decrease, West Point, VA showing a 160 ft. decrease.</figcaption></figure><p>The Virginia Department of Environmental Quality is finally waking up to this problem, but appears to have a limited appetite for addressing the problem head on. From their <a href="https://www.deq.virginia.gov/home/showpublisheddocument/13298/637777551041270000">2021 Annual Water Resources Report</a> (emphasis added):</p><blockquote><em>One of the long-term water resource management challenges in Virginia is the </em><strong><em>historic over-allocation</em></strong><em> of groundwater from the Coastal Plain aquifer system in the Eastern Virginia GWMA, particularly from the Potomac Aquifer.</em></blockquote><blockquote><em>…growing concerns over</em><strong><em> increased water use by new or expanding groundwater withdrawals, overlapping cones of depression, and declining water levels</em></strong><em> in the Coastal Plain aquifer system…</em></blockquote><p>While recognizing the issue, the Department has not rescinded or reduced the permitted withdrawals of these facilities. Instead, Virginia taxpayers are funding an experimental aquifer replenishment program called <a href="https://www.hrsd.com/swift/potomac-aquifer-diminishing-resource">SWIFT</a>. At considerable public expense, SWIFT will begin pumping in a fraction of 1% of the water that International Paper will continue pumping out. As best I can tell, International Paper is not paying for this public service, nor is it paying for the water it draws from the aquifer beyond nominal permitting fees.</p><h3>Moral Hazard</h3><p>Risk, as commonly understood, is the chance that something bad happens to you. In insurance, a <em>hazard</em> is something that increases that risk. <em>Moral hazard</em> occurs when you’ve taken some precaution to protect yourself from a risk, and because of that, forgo taking additional precautions against that same risk that you might otherwise take. A related idea, <a href="https://www.amazon.com/Too-Big-Fail-Washington-System/dp/0143118242?&amp;linkCode=sl1&amp;tag=norfolknetwor-20&amp;linkId=3b350da872fbc9f26cd2aca2b76c19b6&amp;language=en_US&amp;ref_=as_li_ss_tl">Too Big to Fail</a>, made many headlines post-Great Financial Crisis.</p><p>Moral hazard is not abstract sociological theory — it is priced into every insurance policy that you buy. It represents an implicit transfer of risk from one party to another. One example of moral hazard is a bureaucrat bearing no personal consequences for the investment results of spending money that is not their own. Another is a firm monopolizing a shared resource and not paying for the negative impacts it has on others who share it.</p><p>Moral hazard can also result in the wholesale creation of new risks, and often does. If you feel protected by a giant sea wall that surrounds your city, you will make different decisions than you would if the wall were not there. At the margin, buyers will be more interested in properties in areas that were formerly flood-prone, but which appear to be no longer at risk. Investors will develop areas of your city that only make sense to develop if you first assume an utterly impervious wall that can never fail.</p><blockquote>But it is a timeless fact of engineering that <strong>all single points of failure eventually fail</strong></blockquote><p>In the short term, this can feel good. It can create a boom, even. Properties and areas that were formerly untouchable are revitalized. Developers realize they can develop land and sell the developed properties without the stain of mandatory flood insurance. More people may move to the area enabling the city to expand its tax base, and its revenues, and may see yet more investments into its governed territory. And these new revenues no longer need to be invested so dutifully in flood mitigation, because that problem is now solved, and it is the city leaders who can be thanked for implementing that solution.</p><h3>The rhyme of history, and Hyrum’s Law</h3><p>In 1965, an enormous sea wall system was built around New Orleans, which included a large area of marshland and swamps in its interior. This spurred the development of new neighborhoods, including in areas that were former marshlands that were stabilized by fill. Because of the wall, these new developments appeared viable. The addition of structures to the filled land caused land to subside, depressing the elevation of many areas within the sea walls of the city. Those same areas were flooded and destroyed exactly forty years later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*34Wq_XXpjCQhJxEt.png" /><figcaption>Handwritten note on the <a href="https://planning.erdc.dren.mil/toolbox/library/ChiefReports/NorfolkCoastal-2019.pdf">Norfolk Coastal Storm Risk Management Study</a>. <strong>“Fully Reviewed this Project — critical to protect the lives, property, and livelihood of Norfolk!”</strong></figcaption></figure><p>As ever, it’s important to distinguish between the result that was hoped for, and the actual outcome. The professional, well-educated, and conscientious designers of the New Orleans sea wall are fine people that anyone would be happy to have marry into their family. And they did not intend to merely delay and amplify the inevitable death and destruction from Hurricane Katrina.</p><p><strong>But, all observable behaviors of a system </strong><a href="https://www.hyrumslaw.com/"><strong>will come to be relied upon by somebody</strong></a>. If the wall seems to work for long enough, then it must continue to work. Even though the designers of Norfolk’s sea wall don’t intend this, Norfolk’s sea wall will likewise become a single point of failure that large sectors of economic activity rely on to never fail.</p><p>A few generations hence, residents of Norfolk might start to wonder why they have this wall at all. It will recede into the background fog of everyday decision-making. It will be assumed as an inviolable part of the geography, and this will be seen as a great success by its designers. But it is a timeless fact of engineering that all single points of failure eventually fail. All you have to do is roll the dice enough times, for long enough. One day, the sea wall will meet a storm surge it cannot hold back. <strong>And because of the fundamental error of building the wall itself on sinking ground, this is likely to happen much sooner than the designers predict.</strong></p><h3>A Bailout for the Wealthy</h3><p>It’s a commonly observed pattern that when the government has money to hand out, the wealthy and connected tend to somehow find their way to the front of the line, to the detriment of those who would benefit most.</p><p>Properties in proximity of rail lines typically are less valuable due in part to the attendant noise and traffic disruption. A century or so ago, <a href="https://en.wikipedia.org/wiki/Norfolk_and_Western_Railway">Norfolk and Western Railway</a> built their tracks on the high ground. That’s right —<strong> in Norfolk, it’s the poorer and less desirable neighborhoods who are <em>least</em> affected by flooding.</strong> It is the wealthy waterfront homeowners who stand to benefit disproportionately from a taxpayer-funded flood wall. To call this a bailout is almost too perfect — “bailing out” literally means removing water from a sinking vessel.</p><p>Wealthier neighborhoods such as <a href="https://en.wikipedia.org/wiki/Ghent_(Norfolk)">Ghent</a>, <a href="https://en.wikipedia.org/wiki/Colonial_Place">Colonial Place</a>, <a href="https://en.wikipedia.org/wiki/West_Freemason_Street_Area_Historic_District">Freemason</a>, and <a href="https://en.wikipedia.org/wiki/Larchmont-Edgewater">Larchmont</a>, in which large swaths are designated as <a href="https://www.fema.gov/glossary/special-flood-hazard-area-sfha">Special Flood Hazard Areas</a>, stand to benefit much more from a massive flood-mitigation investment than poorer neighborhoods such as <a href="https://en.wikipedia.org/wiki/Park_Place_(Norfolk,_Virginia)">Park Place</a>, which enjoy higher base flood elevations and less flood risk.</p><p><a href="https://www.fema.gov/flood-maps">FEMA publishes flood risk information</a> for every property in the United States as part of the National Flood Insurance (NFIP) program. It’s available publicly and for free. It stretches credulity to argue that wealthy, informed buyers making million-dollar investments couldn’t have known what they were doing. At the very least, when you buy a property with a view of the river, you know the river is nearby.</p><h3>Solutions and Tradeoffs</h3><p>Our public discourse tends to be optimized for debating and understanding problems — on these, it is often easy to agree. Few argue that the climate is static, or that relative sea rise is not occurring. Debating and understanding the tradeoffs of various solutions is less straightforward.</p><p>This is because government leaders are in the business of selling solutions. But in the real world, as economist Tom Sowell eloquently warns in his book <a href="https://amzn.to/3TtdtCV">A Conflict of Visions</a>, “there are no solutions, there are only tradeoffs”. The costs of the wall have already swelled from an initial estimate about $1.8 billion, and like all political projects, the direction of any future cost revision will undoubtedly be upward. At the same time, as the land on which it’s built continues to sink, the economic and societal value of the wall will depreciate at precisely the rate of land subsidence. As far as I can tell, this basic fact has been absent from all public discussion until this article.</p><p>There are around 70 thousand structures in Norfolk, all of which supposedly stand to benefit from the $2.6 billion project. At an average cost of around $37,000 per structure, future flood mitigation efforts are being redirected away from the individual structures and channeled toward the wall. And every dollar you spend in one place is a dollar you cannot spend in another. What could be spent on decentralized resilience is instead being spent on a single megaproject. Risk that was once distributed will soon be concentrated, and the stakes amplified. Everyone’s fate is forcibly tied together to a sea wall that cannot fail.</p><p>Often we want so badly to have a solution for something that we charge ahead before fully understanding what we’re doing. We love being sold solutions, and our government leaders love selling them. And so here we are, time and time again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e076f7080917" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Professional Machine Learning Engineer (PMLE) Exam Notes]]></title>
            <link>https://tjwebb.medium.com/google-professional-machine-learning-engineer-pmle-exam-notes-8948e7748313?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8948e7748313</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 02:49:31 GMT</pubDate>
            <atom:updated>2024-11-18T06:18:53.476Z</atom:updated>
            <content:encoded><![CDATA[<h4>The 7 big exam topics plus tips</h4><p>I took and passed the 2024 PMLE exam today (Nov, 2024) for the first time.</p><p>I finished the test in 85 minutes (test is 120 minutes max) and marked two questions for review (there are 50 questions total). There are no case study pre-reads on this exam.</p><p>To prepare for this test, I studied for approximately 30 hours over the span of three weeks. I lack any sort of impressive ML background or training, so I had a lot of catching up to do on this subject. You might need less or more depending on your own background and skillset.</p><h3>General study tips</h3><p>As with the other GCP exams, I prepared primarily by reading the product documentation, reviewing official sample questions and following all the links in the answers, and reading the best practices guides:</p><ul><li><a href="https://cloud.google.com/architecture/ml-on-gcp-best-practices">Best practices for implementing machine learning on Google Cloud</a></li><li><a href="https://www.tensorflow.org/tfx/guide/tft_bestpractices">Tensorflow data preprocessing best practices</a></li><li><a href="https://docs.google.com/forms/d/e/1FAIpQLSeYmkCANE81qSBqLW0g2X7RoskBX9yGYQu-m1TtsjMvHabGqg/viewform">Professional Machine Learning Engineer Sample Questions</a></li></ul><p><strong>This test is new as of October 1, 2024</strong>. As of mid-November, and I saw no courses on udemy or Coursera or anywhere else that had any recent material. If this is your preferred study method, keep this in mind.</p><p>It’s hard to tell what’s deprecated and what’s not. Some stuff is still in Public Preview. I found that the <a href="https://cloud.google.com/vertex-ai/docs/featurestore/overview">“Legacy” FeatureStore documentation</a> was better for learning the concepts than the current one. (It’s called “Legacy” but it’s not deprecated — what does that even mean?). Anyway, it’s weird out there right now.</p><h3>One big fat pattern</h3><p>At least half of the questions take the following form:</p><blockquote>You work at [company], you are trying to build a model that does [X]. The pipeline needs to preprocess data from [database] using algorithms [A,B,C], train your model, and serve predictions under constraints of [Y,Z]. What do you do?</blockquote><ul><li>[company] will be a bank, a healthcare company, a retailer, a gaming startup, etc.</li><li>[X] will range from predicting customer churn, to classifying images, to forecasting sales, and recommending products.</li><li>[database] is often BigQuery or Cloud Storage, occasionally on-premises, sometimes it is left unspecified.</li><li>[A,B,C] are things like min-max scaling, one-hot encoding, etc.</li><li>[Y,Z] can be “minimal cost and latency”, or “minimal infrastructure overhead and maximum scalability”, and everything in between.</li></ul><p>Your job in these questions is to determine the best way to design a system that 1) accomplishes the business goals of training model [X], and 2) satisfies the constraints of [Y,Z], <strong>in that order</strong>. Don’t accidentally ignore the business requirements in trying to meet the technical constraints.</p><h3>The 7 main topics</h3><p>Here’s a non-exhaustive list of topics that you’ll need to know, roughly in order of how many times I remember seeing them come up on the test:</p><ol><li><strong>Vertex Pipelines and Kubeflow. </strong>It seemed like almost every question involved pipelines or kubeflow somehow. Or some of the answers would suggest using them (right or wrong). You need to know when and how to orchestrate pipelines, how they help track model lineage and compare versions, how they can be automated, monitored, and how they help you deploy and manage your models in production.</li><li><strong>Preprocessing and feature engineering. </strong>Know the Tensorflow preprocessing best practices (linked above) like the back of your hand. Some of these were tricky, especially when combined with the constraints given in the question. Know where certain kinds of preprocessing tasks can and cannot be performed. Know how flaws in these pipeline steps can lead to training-serving skew and how to fix them.</li><li><strong>Monitoring, retraining, explainability. </strong>Know how, whether, and when to re-train an existing model based on new data that has arrived into the training set, or based on metrics gathered from serving the model in production. Know how to set up and use feature attribution to detect drift, explain predictions, and the differences in explanation methods (Shapley, XRAI, etc).</li><li><strong>Vertex Workbench, Experiments, and Notebooks.</strong> The question sometimes involves a team doing “experiments”, and you need to know how to use and configure Experiments, Metadata, etc. to manage the chaos. Know the uses and limitations of workbench and notebooks.</li><li><strong>Serving and scaling.</strong> Know when to deploy to a new Vertex endpoint vs. the same one with traffic splitting. Know the features and limitations of Vertex endpoint auto-scaling (it’s not good for sudden spikes!), and know patterns for low-latency online serving vs. batch predictions.</li><li><strong>The algorithms. </strong>Matrix factorization is good for recommendations. ARIMA is good for time series forecasting. Customer churn is a classification problem. Predicting house prices is a regression problem. And so forth.</li><li><strong>The basics</strong>. A solid grasp of the basics is critical. You don’t want to spend your time trying to remember the differences between accuracy and precision, labels and features, or when to use a confusion matrix or an F1 score. If you don’t have a solid grasp of these, the test will be even less fun than it already is.</li></ol><h3>Tips and Trivia</h3><p>Some other things that might be useful:</p><ul><li>Orchestrating an ML pipeline with Composer/Airflow is almost never the move</li><li>Knowing when/where you can use CPUs, GPUs, and TPUs in training will help you eliminate wrong answers.</li><li>There were a couple questions that involved bias. Fix these in the preprocessing stage rather than trying to correct for them after the model is trained.</li><li>I had a question about <a href="https://cloud.google.com/blog/products/ai-machine-learning/faster-distributed-training-with-google-clouds-reduction-server">ReductionServer</a>. I did not know what this was.</li><li>There’s very little specifically about “generative AI”</li></ul><p>Hope that helps, and good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8948e7748313" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spatial grid systems in BigQuery]]></title>
            <link>https://tjwebb.medium.com/spatial-grid-systems-in-bigquery-d15f8133cb52?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d15f8133cb52</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[bigquery]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Thu, 11 Jul 2024 16:59:59 GMT</pubDate>
            <atom:updated>2024-07-11T17:23:14.265Z</atom:updated>
            <content:encoded><![CDATA[<h4>Spoiler: postal codes are not polygons</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*GGSPuzlRSb8bx83gKlXW4A.png" /></figure><p>We recently published a new guide in our BigQuery documentation on <a href="https://cloud.google.com/bigquery/docs/grid-systems-spatial-analysis">using grid systems for spatial analysis</a>. I’d like to share the inside scoop on how this guide came to be, why we wrote it, and how it can help you improve the way you do geospatial analysis in BigQuery.</p><p>Ever since BigQuery added geospatial capabilities <a href="https://cloud.google.com/bigquery/docs/release-notes#September_10_2018">in 2018</a>, it has used <a href="http://s2geometry.io/">S2 geometry</a> under the hood to organize the data in spatial tables. About 6 months later, the ability to cluster tables on a GEOGRAPHY column was made generally available to our Cloud customers. This made most kinds of spatial queries much more performant and cost-efficient.</p><p>S2 is a fine system for organizing spatial data into regular grid cells — as is <a href="https://www.uber.com/blog/h3/">H3</a>, developed by Uber. They slice up the world into smaller sections that can be reasoned about, indexed, queried, and compared. They are very useful. But many customers I work with are not using them.</p><h3>That’s how we always did it</h3><p>This isn’t to say they are using nothing, because for many use cases, it’s necessary to group things together <em>somehow. </em>Unfortunately, one of the common grouping methods I run across is to group nearby features together by postal code, census tract, or county.</p><p>Retailers like to compare demographics by postal code or county. Insurers often tally results by census tract.</p><p>These use cases can work reasonably well much of the time, but maintenance headaches and data quality issues inevitably creep in. Census tracts change. Counties annex other counties. And <a href="https://web.archive.org/web/20050209030255/http://www.manifold.net/cases/zip_codes/zip_codes.html">postal codes are not actually polygons at all</a> — they never were.</p><p>The US Census Bureau has dutifully published <a href="https://www.census.gov/geographies/mapping-files/2020/geo/tiger-line-file.html">Zip Code Tabulation Areas (ZCTA)</a> datasets, lending this dubious method the imprimatur of the US government and making it appear that postal codes are more useful for “tabulation” than they really are. For a long time, they were the only available system to easily subdivide earth’s surface into manageable chunks, so their ubiquity is not surprising. But there is a better way.</p><h3>S2 and H3 grid systems</h3><p>When you’re comparing areas, you don’t usually want those areas to be arbitrary shapes drawn by humans — or worse: <em>politicians</em>. You want a regular subdivision that you (and your database) can reason about mathematically and logically. You want simple four or five or six-sided shapes, instead of a complex boundary with thousands of points. You want to be able to easily “zoom” in and out of an area to expand or narrow your analysis’ area of interest. You want to quickly and efficiently navigate from one area to an adjacent area without needing to perform a spatial intersection.</p><p>Crucially for machine-learning use cases, which often need to look at examples over long periods of time for training, a regular grid system provides your training process with an apples-to-apples comparison of area statistics over time. Because administrative boundaries (like postal codes) change over time, these changes can heavily influence and distort the training process.</p><p>Regular grid systems like S2 and H3 give you all these properties. They are easier on your database engine (and, therefore, your wallet), and easier on your eyes when you need to visualize the results of your analysis.</p><p>To learn more about how to incorporate these into your BigQuery analyses, <a href="https://cloud.google.com/bigquery/docs/grid-systems-spatial-analysis">check out the full guide</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d15f8133cb52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ‘trie’ data structure gets a new name]]></title>
            <link>https://tjwebb.medium.com/the-trie-data-structure-gets-a-new-name-d4f8a0b9e21c?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4f8a0b9e21c</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[trie-data-structure]]></category>
            <category><![CDATA[tech-interview]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 14:34:04 GMT</pubDate>
            <atom:updated>2023-08-15T14:38:21.083Z</atom:updated>
            <content:encoded><![CDATA[<h4>Homonyms don’t make good technical terms</h4><p>A trie is a subtype of the tree data structure that is helpful for indexing strings. But how to pronounce something spelled “trie” ?</p><p>The phonetics of “trie” are an abject quagmire. By remaining fully-ambiguated in normal conversation, the <em>more pedantic among us</em> can subtly test whether the listener understands just which tr*e is being referred to. Or worse, pronounce it as “try” and wait for your conversation partner to respond with, “tri- what?”</p><p>From Wikipedia:</p><blockquote>The idea was independently described in 1960 by <a href="https://en.wikipedia.org/wiki/Edward_Fredkin">Edward Fredkin</a>, who coined the term <em>trie</em>, <strong>pronouncing it </strong><a href="https://en.wikipedia.org/wiki/Help:IPA/English"><strong>/ˈtriː/</strong></a><strong> (as “tree”)</strong>, <strong>after the middle syllable of <em>retrieval</em>.</strong></blockquote><p>This reasoning, while cute, makes absolutely no sense.</p><p>The trie data structure nomenclature has been an abomination for too long. Software Engineers love destroying legacy baggage and <a href="https://fs.blog/chestertons-fence/">Chesterton’s gates</a>, and in that spirit, today I’m announcing that what was formerly known as the trie is now called the <strong>prefix tree</strong>. Because the whole point is that it stores word prefixes as an index for the full word. Get it? Of course you do. It makes nothing but sense. Even wikipedia suggests it as an alternative to “trie”, so there you go.</p><h3>Everybody’s got a story</h3><p>Four years ago I interviewed at Google, and one of the interviews was a coding test. Following the test was a discussion about some existing code that I was asked to analyze. It was clearly an implementation of a <strong>prefix tree</strong> in Python. After I referred to it as “prefix tree” multiple times, the interviewer finally asked:</p><blockquote>You’re talking about a trie, right? As in, T-R-I-E?</blockquote><p>Yes I was, which I use to disambiguate between it and other types of trees, in the same way I might say “oak tree” instead of “troake”. Not everything needs its own special chimeric neologism. In any case, I went on to pass that interview, so I do have a somewhat special place in my heart for the mis-naming of trie.</p><p>But nostalgia should not override logic. And if you have to spell out a technical term phonetically like you’re broadcasting over ham radio, maybe it’s time to think about using a different name.</p><p>That new name is here. Stop calling it a trie, or T-R-I-E, or try: it’s called the <strong>prefix tree</strong>. Enjoy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4f8a0b9e21c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An overly theoretical approach to understanding margin of safety]]></title>
            <link>https://tjwebb.medium.com/another-approach-to-understanding-margin-of-safety-d50049529eb2?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d50049529eb2</guid>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[security-analysis]]></category>
            <category><![CDATA[margin-of-safety]]></category>
            <category><![CDATA[investing]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 04:58:50 GMT</pubDate>
            <atom:updated>2023-08-15T14:39:46.761Z</atom:updated>
            <content:encoded><![CDATA[<h4>Acquire options at negative cost</h4><p>I’ll wind a circuitous — possibly tortuous — path toward understanding margin of safety from a different angle than is typically discussed.</p><h3>Some basics</h3><p>A transaction is an exchange of one thing for another between two parties. A contract is an agreement between parties made in order to facilitate some transaction. Let’s imagine the simplest possible contract. A agrees to invest $1 with B for immediate exchange of $1. In other words, investor A gives investor B a dollar, and B turns around and gives it right back to A.</p><h3>A simple scenario</h3><p>Because we’re discussing finance, let’s securitize this contract and turn it into a tradable security S with an open market and a clearinghouse to verify and consummate transactions between parties. So A, by doing nothing other than being a participant in this market and holding at least $1 in cash, now has at any time the <em>option to buy</em> this security at the quoted market price. And B, by being a participant in the market and owning this security S, has the <em>option to sell</em> S at the quoted market price. The market price consists of two components: the bid, determined by the price at which A is willing to buy; and the ask, the price at which B is willing to sell. When A and B agree on a single price, this becomes the <em>market clearing price</em>, which is the price at which a transaction occurs between the two consenting parties.</p><p>The value of any financial asset is the sum of discounted cash flows that the asset will produce over the course of its life, which is also called <em>net present value</em>. For security S, its lifespan consists of a single moment in time: the instantaneous exchange of one dollar for one dollar. It’s NPV is thus easy to calculate:</p><blockquote>NPV = 1</blockquote><p>Presumably, as in any market, there can exist prices for S at which transactions do not occur. Because A will always receive $1 in exchange for whatever is paid for S, we might assume that A would never pay a price above $1 for security S, and B would not want to sell at a price less than $1. For example, A may not want to buy S at a price of $1.01. By paying $1.01 and receiving only $1 in exchange, A has suffered a loss of capital in the amount of $0.01, or one cent. This loss may not be subjectively damaging to A’s finances, but the loss is, nonetheless, <em>permanent.</em> In other words, no matter how long investor A holds security S, A will forever be one penny poorer than had A never engaged in the transaction in the first place. <strong>Investor A did not suffer this loss because the security itself was at all <em>risky</em> in the conventional sense— in fact, that A would receive $1 for his investment was an absolute certainty — but A exposed himself to risk anyway by paying more for the security S than the sum of discounted cash flows it would ever produce.</strong></p><p>Likewise, investor B can expose himself to the risk of capital loss by selling the security S below its net present value. If B sells S for only $0.99, he too will suffer permanent loss of capital by giving up something he owned that is worth one dollar in exchange for only 99 cents cash. B’s net worth, therefore, delines by one penny by selling security S for only 99 cents.</p><p>Notice that risk of capital loss is not at all related to whether or not S is what might be colloquially called a “good investment” or “bad investment”. If the investor looks to the asset itself to deliver value, then once the value of the security is established with a reasonable degree of confidence, the investor only needs to be concerned with paying a reasonable price for the security in order to avoid the risk of loss. In the scenario laid out, paying a reasonable price means any price that is less than or equal to the NPV of one dollar.</p><p>Receiving $1 in exchange for $1 obviously accomplishes nothing for either the buyer or the seller. But engaging in a transaction at any other price leaves one investor better off, and the other worse off. Contrary to our presumption above that transactions would not occur at a price other than $1, it is in fact only prices greater or less than $1 at which transactions would likely take place in a real market, because it is at these prices that buyers and sellers may feel that they can accomplish something.</p><h3>All options have value</h3><p>(for some reason, <a href="https://tjwebb.medium.com/the-zillow-debacle-no-algorithm-is-smart-enough-to-overcome-basic-flaws-9fdb6badbdcd">this lesson remains unlearned</a> even by finance professionals)</p><p>What is accomplished by B for selling security S at less than $1? From time to time, B may prefer having cash to owning a security. For example, B is contemplating a large discretionary purchase, or needs to make a non-discretionary payment on a debt, and the recipient would not accept the security S in lieu of cash. In cases where B does not have sufficient cash to meet these other obligations, B must sell the security for cash, becoming a <em>forced seller</em>. Being in a position where B is forced to sell the security, this necessarily revokes the <em>option</em> of selling the security. If, at that time, the highest bidder in the market is then only willing to pay 99 cents for the security with a NPV of one dollar, then the <em>option to sell</em> security S can be said to have a value of one cent. In this line of reasoning, it’s not difficult to see how, at other times, this option to sell may have an even greater value; if for example the highest bidder in the market is only willing to pay 85 cents, then the option to sell at that time has a value of 15 cents. By being forced to sell, the seller B is giving away, for the price of zero, the option to sell at a price that would be preferable to B had he retained the option.</p><p>In a rational setting, it is tempting to think that no buyer would similarly be forced to relinquish the option to buy. In the case of the seller B, he is forced to sell because of external obligations. In the case of buyers, however, the option to buy at a price congruent with a rational evaluation of net present value is quite often relinquished by the buyer’s own free will. This often happens because the buyer perceives a value that is much higher than the actual value of the security he wishes to purchase — the mere fact that he <em>wishes</em> to purchase it already distorts a hitherto “informed judgment” of value.</p><p>Another phenomenon that could cause a buyer to give up his option to buy, and which occurs frequently enough to be well-documented, is that of social frenzy. This typically occurs when the quoted market price, itself, is mistakenly factored into the buyer’s assessment of value. A recent history of increasing market prices, whereby so-called financial experts as well as the general public are regularly bidding the price of the security to ever higher levels, can become linked to the value of the security itself in the mind of a buyer.</p><p>The buyer might also put himself at additional disadvantage by placing himself in competition with other buyers if the security is perceived to be <em>scarce</em>. If supply of the security from sellers is perceived to be limited, buyer might think that even if the NPV of the security itself is higher than the quoted market price, the buyer might feel confident that he can re-sell the security to another market participant at a yet-higher price, who he thinks would also perceive the security scarce at some future time, and factors in this confidence into his own assessment of what he is willing to pay for the security.</p><p>If the pattern persists for long enough and, even worse, he might gain personal first-hand knowledge of another market participant successfully executing a <em>trade</em> of re-selling a security for a higher price than it was purchased for, providing a concrete anecdote of successfully extracting more value from his ownership of the security than the security itself will ever produce. In this case, where the opportunity for profit seems probable, and the supply of the security seems scarce, these facets might conspire in the mind of a buyer to make him feel he has no choice but to pay whatever the market asks at that time. In this way, by delegating his own assessment of underlying value to other market participants and placing himself in direct competition with other buyers for a resource perceived as scarce, he relinquishes his option to buy at a price that is consistent with his own assessment of the value of the security.</p><blockquote>Option to sell = NPV <em>minus</em> selling price</blockquote><blockquote>Option to buy = NPV <em>minus</em> purchase price</blockquote><p>The option to buy, and the option to sell, both have non-zero value at all times where the quoted market price is not equal to NPV. And because securities often do not trade on markets at their NPV, the market often implicitly assigns non-zero values to options to buy and sell that all market participants possess.</p><p>A buyer who would exercise their option to buy a security from a seller at a price equal to its NPV is not giving up or receiving any value from his option to buy nor the seller’s option to sell. On the other hand, a buyer who exercises the option to buy from a seller who is forced to sell a security for less than its NPV (i.e. a seller who has given away their option to sell for free) allows the buyer to also acquire the value of the seller’s option at a price of zero. If the buyer A buys security S (which has NPV = $1) for 60 cents from seller B, buyer A proves that B’s option to sell was worth 40 cents at that moment in time wherein the seller B’s ask was reflected in a quoted market price of 60 cents.</p><p>In these terms, buying below NPV can be characterized as an immediate profit by acquiring the seller’s valuable option to sell at a price of zero; and selling above NPV can likewise be characterized as an immediate profit by acquiring the buyer’s valuable option to buy at a price of zero.</p><h3>Time value of options</h3><p>There exist specialized options exchanges, where buyers and sellers can transact options with one another directly without needing to own the underlying asset. However all options available for sale directly have expiration dates, and they <em>decay</em> as time passes, which is to say they lose their value over time. If unexercised at the expiration date, they expire and are assigned a new value of zero, which means that their former value is permanently irrecoverable. In other words, an expired option causes a permanent loss of capital.</p><p>The options of market participants to buy and sell securities never expire, irrespective of how they were acquired, and their value does not decay. If a buyer buys a security from a seller, the buyer now possesses the value of the seller’s option to sell (or, suffers a loss of capital if the buyer pays more than NPV, as described above). In any case, the value of that option never expires, whether it is positive or negative.</p><h3>Getting back to Margin of Safety</h3><p>The Margin of safety is a fundamental concept in investing that has been discussed at length by Ben Graham, Warren Buffet, Seth Klarman in his eponymous book, and many others. I won’t rehash these discussions here. To summarize the idea, it can be lazily stated as “paying less for something than what it is really worth”. Like many other things in investing, it sounds easy and obvious, but also vague. I will try to make it more concrete by connecting it to the previous discussion on options.</p><p>As shown in the previous sections, paying more than its NPV for any security represents a permanent loss of capital by transferring the <em>value of</em> the option to buy to the seller and charging nothing for it. Likewise, paying less than NPV for any security represents an increase in capital, by receiving for the cost of zero the <em>value of</em> the seller’s option to sell.</p><p>Applying the margin of safety in practice involves three important principles:</p><p>1. It is impossible to know exactly what the NPV of a security is. Discount rates, terminal values, and other arithmetic assumptions can affect the calculated NPV, as well as informed judgment of the soundness of the underlying asset that the security represents.</p><p>2. It is usually possible to discern when a security is significantly overpriced where the market price represents a large (~2x or more) premium to an informed judgment of its NPV.</p><p>3. It is usually possible to discern when a security is wildly underpriced where the market price represents a large (~50% or more) discount to an informed judgment of its NPV.</p><p>“Informed judgment” does not imply a perfect and precise analysis. (I may expand on exactly what this <em>does </em>mean in another article). In general, it implies only that the investor reasonably understands the future prospects of the business, and can use this understanding to independently determine a reasonable estimate of the cash flows it will produce over time without being influenced by other market participants.</p><p>It’s clear from principle #2 that an investor does not want to pay significantly more than a security’s NPV — this guarantees that the investor is worse off than before, because they will suffer a permanent loss of capital. That is, the buyer pays $1 and receives less than $1 of discount cash flows in return for his investment. This is not merely risky, it is destructive.</p><p>It’s also clear in principle #1 that paying something close to NPV is risky, since it’s not possible to know exactly what the NPV is. The investor might be better off, but might not be. This is a gamble that introduces additional risk that is not necessary.</p><p>Sellers regularly offer securities at prices that, even if in their own internal P&amp;L shows a profit to the seller, nonetheless represent a transfer of option value to the buyer. <strong>Margin of safety, in this context, can be thought of as acquiring an option at negative cost. </strong>Put another way, the investor earns a return at the time of purchase, rather than at the time of sale.</p><p>Taking into account principles #1 and #3, along with everything discussed above, the <strong>only</strong> reliable way to avoid the risk of permanent capital loss, and with a prospect of acquiring an option at negative cost, is to buy a security only when offered by a seller at a significant discount to an informed judgment of its net present value.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d50049529eb2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Professional Cloud Architect Cert Exam Notes]]></title>
            <link>https://tjwebb.medium.com/google-professional-cloud-architect-cert-exam-notes-49756c000620?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/49756c000620</guid>
            <category><![CDATA[cloud-architect-exam]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Wed, 31 May 2023 20:31:39 GMT</pubDate>
            <atom:updated>2023-05-31T21:43:10.957Z</atom:updated>
            <content:encoded><![CDATA[<h4>7 Big Exam topics</h4><p>I took and passed the Google Cloud Architect certification exam today for the third time. This test was similar to my previous two takes (in 2021, and 2019) with a few changes in service naming and emphasis, and it reflects some new features that have been added over the years, but the core idea remains the same: know how to architect, deploy, and manage resources in Google Cloud.</p><p>I finished the test in 65 minutes. As with <a href="https://tjwebb.medium.com/google-cloud-security-engineer-exam-21f55d3dd5a7">other certification exams</a> I’ve taken, I don’t use 3rd party courses for studying, and instead read through the official documentation that pertains to the topics in the <a href="https://cloud.google.com/learn/certification/cloud-architect">exam overview</a>. Also, <a href="https://docs.google.com/forms/d/e/1FAIpQLSf54f7FbtSJcXUY6-DUHfBG31jZ3pujgb8-a5io_9biJsNpqg/viewform">the sample test</a> is extremely valuable both to gauge your understanding and as a self-contained study guide. <em>Hint: </em>read through the explanations of the incorrect answers, and follow documentation links.</p><p>The exam includes two of the four case studies. While reading through these in advance is probably helpful and may save you some time, it doesn’t change the basic scope of material that is covered. You’ll still need to reason about the case study questions in the same way you’d reason about the other scenario questions in the test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*H3VdnbTVUhccgVcs" /></figure><p>Here’s a non-exhaustive list of topics that you’ll need to know, roughly in order of importance:</p><ol><li><strong>IAM and Resource Manager </strong>are simple and straightforward concepts to understand, but they are <em>everywhere</em> on the test — any gaps in knowledge here will cost you. Understand best practices around org policies, folders, and projects; know how permission inheritance works (and how it <em>doesn’t </em>work); and know service accounts inside-out. A lot of questions involve preventing users from doing stuff they aren’t supposed to (e.g. modifying Project resources, accessing restricted data).</li><li><strong>Hybrid Connectivity</strong> is a heavily-covered topic on the exam. Know when to use partner vs. direct interconnect, know Classic vs. HA Cloud VPNs, and know the advantages and limitations to each approach — especially concerning how each method deals with IP address ranges, availability requirements, and cost.</li><li><strong>Cloud Storage Buckets</strong> are another deceptively simple concept that feature prominently in test questions. Understand permissioning and how to restrict public access. Know when to use retention, versioning, and lifecycle policies — especially as they relate to regulatory compliance.</li><li><strong>Compute Engine— </strong>make sure you understand the differences between instance vs. persistent disks (as well as regional PDs). MIGs vs. unmanaged instance groups. Most GCE questions were not straightforwardly academic, but instead tested your knowledge through real-world scenarios.</li><li><strong>Networking</strong> is another pervasive concept that is imbued into many scenario questions, and is occasionally tested directly. Load Balancers will come up in the test. Understand firewall rules (including rules logging) and network tags. Understand VPCs and subnets, especially as they relate to <strong>Hybrid Connectivity</strong>.</li><li><strong>Security and Compliance </strong>will often appear as a constraint in scenario questions, and you’ll need to know how to get something done within security or compliance constraints. For all exam questions, always assume the <em>principle of least privilege. </em>Security will relate closely to <strong>IAM</strong> as well as <strong>Networking</strong>. Make sure you know when to use Cloud KMS and how to set up key rotation and understand when to use DLP (usually to remove PII from something).</li><li><strong>Logging and Monitoring — </strong>make sure you understand logging exports, alerts, and best practices around monitoring and debugging both inside of GKE and in general. You usually want to create a dedicated project for log aggregation and analysis, and don’t export to a Storage Bucket if someone needs to do detailed analysis.</li></ol><p>There are also a few bits of what I’ll call “trivia” that I’ve seen come up in each test:</p><ul><li>know that Billing Exports to BigQuery only captures billing data that is produced <em>after</em> it’s been enabled</li><li>Bigtable keys need to be evenly spaced to prevent hotspots</li><li>To lift-and-shift a Spark cluster with minimal changes, use Dataproc</li><li>make sure you know how to do parallel GCS uploads using gsutil</li><li><a href="https://firebase.google.com/docs/test-lab">Firebase Test Lab</a> is a thing that exists</li></ul><p>I hope this was helpful to anyone who is studying for the latest Google Cloud Professional Architect certification exam. Good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49756c000620" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nvidia is having an “Intel Inside” moment]]></title>
            <link>https://tjwebb.medium.com/nvidia-is-having-an-intel-inside-moment-acd646c478bc?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/acd646c478bc</guid>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Fri, 26 May 2023 18:49:55 GMT</pubDate>
            <atom:updated>2023-05-31T21:44:10.047Z</atom:updated>
            <content:encoded><![CDATA[<h4>And history suggests that it won’t last</h4><p>The 1990s were a chaotic and exciting period in computing history. Not only was the World Wide Web finally emerging from the lab, but also PCs were becoming more useful outside the workplace. To bring order to the chaos, Microsoft and Intel forged the “Wintel” partnership, which provided a common platform for software developers, improved software compatibility, and delivered a relatively predictable consumer experience. The focal point of home computing in the 90s was the “Intel Inside” branding campaign.</p><blockquote>There was a time when you didn’t have a “real” computer if it wasn’t a Pentium. These days, nobody cares.</blockquote><p>Brands and retailers need each other, but wish they didn’t. Heinz ketchup needs Walmart to get their products in the hands of customers, and Walmart needs Heinz to offer shoppers the brands they expect when they enter the store. But there exists a constant tension: Walmart would prefer to sell everyone their own private-label ketchup to capture higher margins, and to strengthen the Walmart brand in the mind of the consumer. Heinz wants the same thing, but has no option but to sell through Walmart because laying out the capital to build ten thousand ketchup stores is a dubious proposition.</p><p>We oscillate between periods of retailer power and brand power. From time to time, customers may prefer buying the cheaper store brand, which weakens the negotiating position of Heinz. During other times, consumers want <a href="https://slate.com/culture/2015/05/coca-colas-its-the-real-thing-ad-how-the-mccann-erickson-ad-changed-american-advertising-and-america.html">The Real Thing</a>, and will demand branded products by name — crucially, during periods of extreme brand power, customers will drop their shopping cart and walk right out the door if they don’t find the brand they expect to see. This does happen occasionally, and these vicissitudes are as natural and reliable as any other cycle of human behavior— it always reverts.</p><p>We are experiencing a rare period where enterprise customers are walking into the store and demanding Nvidia GPUs <strong><em>by name</em></strong>. Whereas Heinz sold to Costco and Walmart, Nvidia sells to the hyperscale cloud providers: Google, Microsoft, and Amazon. If Amazon doesn’t have enough H100 GPUs for all their customers who want them, the customer will take their cloud workload to Google — this is the first time this has happened in the Cloud computing business. (And because you don’t want this to happen, you might buy a few extra racks of GPUs even if they aren’t needed, just to keep them out of your competitors’ hands). Just like Heinz and Walmart, the cloud providers have their own competing offerings that they’d rather sell: Google offers <a href="https://cloud.google.com/tpu/docs/intro-to-tpu">Cloud TPUs</a>, which arguably offer many advantages over Nvidia’s GPUs; Amazon offers <a href="https://aws.amazon.com/machine-learning/trainium/">Titanium ML Accelerators</a>; and Microsoft offers <a href="https://learn.microsoft.com/en-us/azure/machine-learning/v1/how-to-deploy-fpga-web-service?view=azureml-api-1">ML-accelerated FPGAs</a>.</p><p>Apple’s incremental move toward building their own chips hammers home this desire of brands to maintain and strengthen their mindshare with customers. In addition to any technical benefits, Apple fundamentally wants to be able to say that this is an “Apple” computer from top to bottom, not an Intel-powered computer with an Apple-designed veneer. The Cloud providers have a similar desire to differentiate in this way and avoid commoditization. They may not be able to make it all happen today, but this will be the tendency over time.</p><p>The primacy of the Pentium lasted a little more than five years: demand ramped up with the launch of Windows 95, and began to subside in the early 2000s with the disappointing launch of the Pentium 4. By the mid 2000s, not only were Apple and Linux beginning to attack the market share of Windows and weakening Microsoft’s half of the partnership, and the mobile phone became a larger part of American life, but offerings from peer competitors such as AMD became much more competitive against the Intel lineup. Likewise, Nvidia faces peer competitors such as AMD and Intel racing to capture market share; Nvidia also faces latent competition from Cloud providers who make up the bulk of Nvidia’s “datacenter” segment customers.</p><p>An additional complicating factor here is that Nvidia, AMD, and many others compete for the productive capacity of a single firm: TSMC. Economics tells us that scarce resources are always put to their highest valued uses — that is, whoever delivers the most profitable end-product will have the advantage in securing scarce production capacity. And on this front, Nvidia is competing with the likes of Apple, Google, and the United States military. So, an investor looking to capitalize on temporary ML hype should think very hard about who really has the pricing power in this equation.</p><p>Cyclicality is inherent in the semiconductor industry as a whole, and it is inherent in the retailer/brand tension dynamic. There was a time when you didn’t have a “real” computer if it wasn’t a Pentium—these days, nobody cares. And now <a href="https://tjwebb.medium.com/nvidia-owes-you-950-billion-87ed3f75be41">Nvidia is being valued by equity investors</a> like Intel was in the late 1990s: for perpetually-increasing profits and world domination. That, of course, didn’t happen.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acd646c478bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nvidia owes you $950 billion]]></title>
            <link>https://tjwebb.medium.com/nvidia-owes-you-950-billion-87ed3f75be41?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/87ed3f75be41</guid>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[valuation]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[security-analysis]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Thu, 25 May 2023 01:27:57 GMT</pubDate>
            <atom:updated>2023-06-02T20:51:07.525Z</atom:updated>
            <content:encoded><![CDATA[<h4>A brief discussion on NVDA’s valuation</h4><p>Nvidia <a href="https://nvidianews.nvidia.com/news/nvidia-announces-financial-results-for-first-quarter-fiscal-2024">earnings</a> were pretty good today. But for a company now valued at nearly a trillion dollars, pretty good is no longer enough.</p><p>Stock in a company is a claim on free cash generated by that company over its life. As of this writing, Nvidia needs to generate $950 billion of discounted cash flows over its lifetime of earnings in order to equal its present value.</p><p>Cash flows are “discounted” because earnings in the future are not as valuable as earnings received today. The sum of all discounted cash flows is the net present value, or NPV. <strong>That is, when company is selling at a price equal to its NPV, you receive exactly $1 in return for your $1 investment.</strong> Investors should aim to pay less than NPV, whereby you receive more than $1 for each dollar invested.</p><p>With investing 101 out of the way, let’s talk about <a href="https://www.google.com/finance/quote/NVDA:NASDAQ">NVDA</a>: At the quoted market price of ~$380, multiplying by the number of shares outstanding, you are paying around $950B for a claim on Nvidia’s future cash flows. <strong>So, how is Nvidia going to generate $950 billion of discounted cash flows?</strong></p><blockquote>GAAP earnings per diluted share for the quarter were $0.82, up 28% from a year ago [<a href="https://nvidianews.nvidia.com/news/nvidia-announces-financial-results-for-first-quarter-fiscal-2024">link</a>], on revenues of $7.2B.</blockquote><p>These revenues and earnings are in the middle of a frenzied mania around Generative AI (or as some say, “<a href="https://www.inc.com/jason-aten/stop-calling-everything-ai-its-just-computers-doing-computer-stuff.html">It’s just computers doing computer stuff</a>”), and the market has quoted NVDA higher and higher in recent months to reflect this excitement that ChatGPT and LLMs and suchlike will result in permanently higher and accelerating demand for Nvidia’s products.</p><p>Let’s say Nvidia’s earnings double every 5 years for the next decade and a half. Quite an impressive growth rate, and starting from very strong earnings. The discounted cash flows of a stock earning (0.82 * 4) = $3.28 per year and growing at 15% per year for 15 years. It would produce $183 per share in cash flows over that period, and discounted at 7% (I use the current long-term mortgage rate; I avoid the <a href="https://www.researchgate.net/publication/46461090_Analytical_solution_to_the_circularity_problem_in_the_discounted_cash_flow_valuation_framework">irrational circularity of WACC</a>) gives us $119.58 per-share net present value of NVDA. Not quite the $380+ stock price ($950 billion). So, under these assumptions, Nvidia is overvalued by ~3.5 times — in other words, we would be paying $3.50 to buy $1.00 in discounted cash flows. Not a good investment.</p><p>But you might say, NVDA earnings grew 28% compared to last year. This is a new era of ChatGPT and large language models. Elon Musk! And those TPUs from Google and Amazon don’t matter. So let’s see what happens when we <strong>assume Nvidia will instead enjoy astonishing 30% earnings growth</strong> every single year for the next 15 years.</p><p>Under these conditions, assuming its current (historically high) 25–30% net profit margin is not competed away, Nvidia would rake in an absolutely stunning <strong>$6.29 trillion in revenues</strong> over this period of 15 years and generate <strong>$1.8 trillion in earnings</strong>, or $716.59 per share. (by comparison, the cumulative earnings of Intel over the past 40 years is $495 billion). In this scenario, the net present value of one NVDA share would be $307.18, or about $760 billion. We’re getting closer, but under these assumptions NVDA remains overvalued by 25%. but to reach $380/share NPV, we would need even more optimistic assumptions.</p><p>Obviously others may use different discount rates or growth assumptions or terminal values. Even though it’s never possible to discern exactly what a company is worth, it’s quite useful in investing to know what a company definitely is <em>not </em>worth. This allows you to avoid things that don’t make sense — in other words, avoid paying more than a dollar for $1 in discounted cash flows.</p><p>As this article showed, the incredible arithmetic needed to justify a present value of $380 per share would require yet higher growth and profitability projections beyond the generous assumptions already made earlier — going much further may require running the computation on one of the new Nvidia H100 GPUs, and is therefore left as an exercise to the reader.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87ed3f75be41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using custom containers with Dataflow flex templates]]></title>
            <link>https://tjwebb.medium.com/using-custom-containers-with-dataflow-flex-templates-f5b59a95ceae?source=rss-7e8a33dc1bc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5b59a95ceae</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[apache-beam]]></category>
            <category><![CDATA[google-cloud-functions]]></category>
            <category><![CDATA[dataflow]]></category>
            <dc:creator><![CDATA[Travis Webb]]></dc:creator>
            <pubDate>Sun, 09 Oct 2022 00:17:04 GMT</pubDate>
            <atom:updated>2022-10-09T17:25:16.996Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s easier than it looks</p><p>Dataflow <a href="https://cloud.google.com/dataflow/docs/guides/using-custom-containers">custom containers</a> are awesome. As an example, custom containers enables <a href="https://github.com/GoogleCloudPlatform/dataflow-geobeam">geobeam</a> to pre-install GDAL, PROJ, and other system dependencies onto dataflow workers to process spatial data at scale. <a href="https://cloud.google.com/dataflow/docs/guides/templates/using-flex-templates">Dataflow templates</a> allow you to templatize a pipeline so that you can easily kick off a job from a Cloud Function, or take advantage of the form UI that is generated for a template.</p><p>Product documentation has to cover everything, so there isn’t always a well-paved happy path for every use case. This article describes how to use custom containers with Dataflow templates.</p><p>Custom containers are useful if your workers need a bunch of extra OS libraries or other dependencies. If you need OS dependencies, custom containers are your best option. Just create your Dockerfile using one of the Apache Beam base images, such as apache/beam_python3.8_sdk:2.41.0. (<a href="https://github.com/GoogleCloudPlatform/dataflow-geobeam/blob/main/Dockerfile">geobeam’s big ugly Dockerfile</a> is available as an example). If you have a ton of language dependencies, custom containers can also reduce worker startup time and make your pipeline run faster.</p><p>First, get your custom container job working by itself, without using a template. The command to start a job might look something like this:</p><pre>python nfhl_pipeline.py <br>  --runner DataflowRunner<br>  --sdk_container_image gcr.io/dataflow-geobeam/base<br>  --project &lt;project&gt;<br>  --temp_location gs://&lt;somewhere&gt;<br>  --service_account_email <a href="/service/mailto:dataflow-runner@geo-solution-demos.iam.gserviceaccount.com">&lt;sa&gt;@&lt;project&gt;.iam.gserviceaccount.com</a><br>  --region us-central1<br>  --dataset nfhl_staging<br>  --worker_machine_type c2-standard-4<br>  --max_num_workers 12<br>  --gcs_url gs://geo-demos/ark-demo/sources/nfhl/NFHL_12_20220411.zip</pre><p>This pipeline imports flood zone and risk data from the National Flood Hazard Layer (NFHL), reprojects the geometries, casts some field types, and inserts the resulting records into BigQuery for analysis.</p><p>But let’s say you only want to pass in gcs_url and have everything else built-in. You might want to only allow a pipeline to use a fixed number workers, or a particular container image, no matter who’s starting the job. Because the container image is coupled tightly to the pipeline code, it can make sense to <em>hardcode</em> that value in the pipeline itself.</p><p>You can configure these values directly in your pipeline code by using the PipelineOptions object:</p><pre>pipeline_options = PipelineOptions(<br>  pipeline_args,<br>  experiments=[‘use_runner_v2’],<br>  temp_location=’gs://&lt;somewhere&gt;’,<br>  sdk_container_image=’gcr.io/dataflow-geobeam/base’,<br>  project=’&lt;project&gt;’,<br>  region=’us-central1&#39;,<br>  worker_machine_type=’c2-standard-4&#39;,<br>  max_num_workers=12,<br>  dataset=&#39;nfhl_staging&#39;<br>)<br>with beam.Pipeline(options=pipeline_options) as p:<br>  # ... etc</pre><p>Now, even running the job normally, you don’t need to set as many command-line flags:</p><pre>python nfhl_pipeline.py <br>  --runner DataflowRunner<br>  --service_account_email <a href="/service/mailto:dataflow-runner@geo-solution-demos.iam.gserviceaccount.com">&lt;sa&gt;@&lt;project&gt;.iam.gserviceaccount.com</a><br>  --gcs_url gs://geo-demos/ark-demo/sources/nfhl/NFHL_12_20220411.zip</pre><p>This can be beneficial by making the pipeline more accessible and easier to use by others, particularly if you’re using a custom container that works best on a particular machine size. Some GDAL operations can be memory and CPU-intensive which is why I want to default to a <a href="https://cloud.google.com/compute/docs/compute-optimized-machines">c2 family</a> machine.</p><h3>Now, templatize</h3><p>Dataflow flex templates consist of a “launcher” container, and a metadata file that specifies the parameters the pipeline should expect. (If you’re used to firing up Dataflow jobs directly for your laptop or <a href="https://cloud.google.com/shell">Cloud Shell</a>, then in that scenario your laptop or Cloud Shell is the “launcher”)</p><p>The <strong>launcher container</strong> image contains only your pipeline code (nfhl_pipeline.py in this case) and any Python dependencies that your main pipeline code requires (e.g. requirements.txt for a Python pipeline, or pom.xml for a Java pipeline). The launcher container doesn’t do any work for your job — it only generates the execution graph that Dataflow uses to farm out work to the workers.</p><p>In this case, my custom container is running Python 3.8, so I use the Python 3.8 version of the launcher template base image: <strong>python38</strong>-template-launcher-base.</p><pre>FROM gcr.io/dataflow-templates-base/python38-template-launcher-base</pre><pre>ARG DIR=/dataflow/template<br>RUN mkdir -p ${DIR}<br>WORKDIR ${DIR}</pre><pre>COPY requirements.txt .<br>COPY nfhl_pipeline.py .</pre><pre>ENV FLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE=”${DIR}/requirements.txt”<br>ENV FLEX_TEMPLATE_PYTHON_PY_FILE=”${DIR}/nfhl_pipeline.py”</pre><pre>RUN pip install --upgrade pip<br>RUN pip install apache-beam[gcp]<br>RUN pip install -U -r ./requirements.txt</pre><p>Now build the launcher container, and docker push it to <a href="https://cloud.google.com/container-registry">Google Container Registry</a>, e.g.</p><pre>docker build -t gcr.io/&lt;project&gt;/nfhl_template_launcher<br>docker push gcr.io/&lt;project&gt;/nfhl_template_launcher</pre><p>The <strong>metadata file</strong> is a json file that identifies the template and specifies its parameters. For the example pipeline above, the metadata.json file is straightforward:</p><pre>{<br>  “name”: “nfhl-template”,<br>  “description”: “load all nfhl layers into bigquery”,<br>  “parameters”: [<br>    {<br>      “name”: “gcs_url”,<br>      “label”: “gcs path to nfhl state geodatabase”,<br>      “helpText”: “gcs path to nfhl state geodatabase”<br>    }<br>  ]<br>}</pre><p>Now that you have the launcher container and the metadata file, we can deploy the new template using the gcloud CLI:</p><pre>gcloud dataflow flex-template build gs://&lt;bucket&gt;/nfhl-template.json<br>  --image gcr.io/geo-solution-demos/nfhl_pipeline_template<br>  --sdk-language PYTHON<br>  --metadata-file metadata.json</pre><p>This creates a template using the specified metadata file and container image, and upload the metadata file to the specified GCS location. Now, it’s ready to run, either from the command-line:</p><pre>gcloud dataflow flex-template run “nfhl-import”<br>  --template-file-gcs-location gs://&lt;bucket&gt;/nfhl-template.json<br>  --parameters “gcs_url=gs://geo-demos/ark-demo/sources/nfhl/NFHL_45_20220329.zip”</pre><p>or programmatically, from a Cloud Function or any other application:</p><pre>def run(data, context):<br>  from googleapiclient.discovery import build</pre><pre>  project = ‘&lt;project&gt;’<br>  job = ‘nfhl-load’<br>  template = ‘gs://geo-demos/ark-demo/templates/nfhl-template.json’<br>  inputFile = ‘gs://’+str(data[‘bucket’]) + ‘/’ + str(data[‘name’])<br>  parameters = {<br>    ‘gcs_url’: inputFile,<br>  }<br>  environment = {‘temp_location’: ‘gs://gsd-pipeline-temp’}</pre><pre>  service = build(‘dataflow’, ‘v1b3’, cache_discovery=False)</pre><pre>  request = service.projects().locations().flexTemplates().launch(<br>    projectId=project,<br>    location=’us-central1&#39;,<br>    body={<br>      ‘launchParameter’: {<br>        ‘jobName’: job,<br>        ‘parameters’: parameters,<br>        ‘environment’: environment,<br>        ‘containerSpecGcsPath’: template<br>      }<br>    }<br>  )<br>  response = request.execute()</pre><p>Now you have a working Dataflow flex template using a custom container that can be launched from Cloud Functions or any other Python program. You can deploy a cloud function that runs when a new file is uploaded using this command:</p><pre>gcloud functions deploy nfhl-pipeline-launcher<br>  --region us-central1<br>  --runtime python38<br>  --entry-point run<br>  --trigger-bucket nfhl-uploads<br>  --source .</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5b59a95ceae" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>