mirror of
https://github.com/deepseek-ai/smallpond
synced 2025-06-26 18:27:45 +00:00
552 lines
21 KiB
HTML
552 lines
21 KiB
HTML
|
|
<!DOCTYPE html>
|
|
|
|
|
|
<html lang="en" data-content_root="" >
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<title>Getting Started — smallpond documentation</title>
|
|
|
|
|
|
|
|
<script data-cfasync="false">
|
|
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
|
|
document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";
|
|
</script>
|
|
|
|
<!-- Loaded before other Sphinx assets -->
|
|
<link href="_static/styles/theme.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
|
<link href="_static/styles/bootstrap.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
|
<link href="_static/styles/pydata-sphinx-theme.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
|
|
|
|
|
<link href="_static/vendor/fontawesome/6.1.2/css/all.min.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
|
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2" />
|
|
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2" />
|
|
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.woff2" />
|
|
|
|
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=8f2a1f02" />
|
|
|
|
<!-- Pre-loaded scripts that we'll load fully later -->
|
|
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=5b4479735964841361fd" />
|
|
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=5b4479735964841361fd" />
|
|
<script src="_static/vendor/fontawesome/6.1.2/js/all.min.js?digest=5b4479735964841361fd"></script>
|
|
|
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js?v=b3ba4146"></script>
|
|
<script src="_static/doctools.js?v=888ff710"></script>
|
|
<script src="_static/sphinx_highlight.js?v=4825356b"></script>
|
|
<script>DOCUMENTATION_OPTIONS.pagename = 'getstarted';</script>
|
|
<link rel="index" title="Index" href="genindex.html" />
|
|
<link rel="search" title="Search" href="search.html" />
|
|
<link rel="next" title="Internals" href="internals.html" />
|
|
<link rel="prev" title="smallpond" href="index.html" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<meta name="docsearch:language" content="en"/>
|
|
</head>
|
|
|
|
|
|
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
|
|
|
|
|
|
|
|
<a class="skip-link" href="#main-content">Skip to main content</a>
|
|
|
|
<div id="pst-scroll-pixel-helper"></div>
|
|
|
|
|
|
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
|
|
<i class="fa-solid fa-arrow-up"></i>
|
|
Back to top
|
|
</button>
|
|
|
|
|
|
<input type="checkbox"
|
|
class="sidebar-toggle"
|
|
name="__primary"
|
|
id="__primary"/>
|
|
<label class="overlay overlay-primary" for="__primary"></label>
|
|
|
|
<input type="checkbox"
|
|
class="sidebar-toggle"
|
|
name="__secondary"
|
|
id="__secondary"/>
|
|
<label class="overlay overlay-secondary" for="__secondary"></label>
|
|
|
|
<div class="search-button__wrapper">
|
|
<div class="search-button__overlay"></div>
|
|
<div class="search-button__search-container">
|
|
<form class="bd-search d-flex align-items-center"
|
|
action="search.html"
|
|
method="get">
|
|
<i class="fa-solid fa-magnifying-glass"></i>
|
|
<input type="search"
|
|
class="form-control"
|
|
name="q"
|
|
id="search-input"
|
|
placeholder="Search the docs ..."
|
|
aria-label="Search the docs ..."
|
|
autocomplete="off"
|
|
autocorrect="off"
|
|
autocapitalize="off"
|
|
spellcheck="false"/>
|
|
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
|
|
</form></div>
|
|
</div>
|
|
|
|
<nav class="bd-header navbar navbar-expand-lg bd-navbar">
|
|
<div class="bd-header__inner bd-page-width">
|
|
<label class="sidebar-toggle primary-toggle" for="__primary">
|
|
<span class="fa-solid fa-bars"></span>
|
|
</label>
|
|
|
|
|
|
<div class="col-lg-3 navbar-header-items__start">
|
|
|
|
<div class="navbar-item">
|
|
|
|
|
|
|
|
<a class="navbar-brand logo" href="index.html">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p class="title logo__title">smallpond documentation</p>
|
|
|
|
</a></div>
|
|
|
|
</div>
|
|
|
|
<div class="col-lg-9 navbar-header-items">
|
|
|
|
<div class="me-auto navbar-header-items__center">
|
|
|
|
<div class="navbar-item">
|
|
<nav class="navbar-nav">
|
|
<p class="sidebar-header-items__title"
|
|
role="heading"
|
|
aria-level="1"
|
|
aria-label="Site Navigation">
|
|
Site Navigation
|
|
</p>
|
|
<ul class="bd-navbar-elements navbar-nav">
|
|
|
|
<li class="nav-item current active">
|
|
<a class="nav-link nav-internal" href="#">
|
|
Getting Started
|
|
</a>
|
|
</li>
|
|
|
|
|
|
<li class="nav-item">
|
|
<a class="nav-link nav-internal" href="internals.html">
|
|
Internals
|
|
</a>
|
|
</li>
|
|
|
|
|
|
<li class="nav-item">
|
|
<a class="nav-link nav-internal" href="api.html">
|
|
API Reference
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</nav></div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="navbar-header-items__end">
|
|
|
|
<div class="navbar-item navbar-persistent--container">
|
|
|
|
|
|
<script>
|
|
document.write(`
|
|
<button class="btn navbar-btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
|
<i class="fa-solid fa-magnifying-glass"></i>
|
|
<span class="search-button__default-text">Search</span>
|
|
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
|
|
</button>
|
|
`);
|
|
</script>
|
|
</div>
|
|
|
|
|
|
<div class="navbar-item">
|
|
|
|
<script>
|
|
document.write(`
|
|
<button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
|
<span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
|
|
<span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
|
|
<span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
|
|
</button>
|
|
`);
|
|
</script></div>
|
|
|
|
<div class="navbar-item"><ul class="navbar-icon-links navbar-nav"
|
|
aria-label="Icon Links">
|
|
<li class="nav-item">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/deepseek-ai/smallpond" title="GitHub" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i></span>
|
|
<span class="sr-only">GitHub</span></a>
|
|
</li>
|
|
</ul></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="navbar-persistent--mobile">
|
|
|
|
<script>
|
|
document.write(`
|
|
<button class="btn navbar-btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
|
<i class="fa-solid fa-magnifying-glass"></i>
|
|
<span class="search-button__default-text">Search</span>
|
|
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
|
|
</button>
|
|
`);
|
|
</script>
|
|
</div>
|
|
|
|
|
|
|
|
<label class="sidebar-toggle secondary-toggle" for="__secondary" tabindex="0">
|
|
<span class="fa-solid fa-outdent"></span>
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
<div class="bd-container">
|
|
<div class="bd-container__inner bd-page-width">
|
|
|
|
<div class="bd-sidebar-primary bd-sidebar hide-on-wide">
|
|
|
|
|
|
|
|
<div class="sidebar-header-items sidebar-primary__section">
|
|
|
|
|
|
<div class="sidebar-header-items__center">
|
|
|
|
<div class="navbar-item">
|
|
<nav class="navbar-nav">
|
|
<p class="sidebar-header-items__title"
|
|
role="heading"
|
|
aria-level="1"
|
|
aria-label="Site Navigation">
|
|
Site Navigation
|
|
</p>
|
|
<ul class="bd-navbar-elements navbar-nav">
|
|
|
|
<li class="nav-item current active">
|
|
<a class="nav-link nav-internal" href="#">
|
|
Getting Started
|
|
</a>
|
|
</li>
|
|
|
|
|
|
<li class="nav-item">
|
|
<a class="nav-link nav-internal" href="internals.html">
|
|
Internals
|
|
</a>
|
|
</li>
|
|
|
|
|
|
<li class="nav-item">
|
|
<a class="nav-link nav-internal" href="api.html">
|
|
API Reference
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</nav></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="sidebar-header-items__end">
|
|
|
|
<div class="navbar-item">
|
|
|
|
<script>
|
|
document.write(`
|
|
<button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
|
<span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
|
|
<span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
|
|
<span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
|
|
</button>
|
|
`);
|
|
</script></div>
|
|
|
|
<div class="navbar-item"><ul class="navbar-icon-links navbar-nav"
|
|
aria-label="Icon Links">
|
|
<li class="nav-item">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/deepseek-ai/smallpond" title="GitHub" class="nav-link" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><span><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i></span>
|
|
<span class="sr-only">GitHub</span></a>
|
|
</li>
|
|
</ul></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="sidebar-primary-items__end sidebar-primary__section">
|
|
</div>
|
|
|
|
<div id="rtd-footer-container"></div>
|
|
|
|
|
|
</div>
|
|
|
|
<main id="main-content" class="bd-main">
|
|
|
|
|
|
<div class="bd-content">
|
|
<div class="bd-article-container">
|
|
|
|
<div class="bd-header-article">
|
|
<div class="header-article-items header-article__inner">
|
|
|
|
<div class="header-article-items__start">
|
|
|
|
<div class="header-article-item">
|
|
|
|
|
|
|
|
<nav aria-label="Breadcrumb">
|
|
<ul class="bd-breadcrumbs">
|
|
|
|
<li class="breadcrumb-item breadcrumb-home">
|
|
<a href="index.html" class="nav-link" aria-label="Home">
|
|
<i class="fa-solid fa-home"></i>
|
|
</a>
|
|
</li>
|
|
<li class="breadcrumb-item active" aria-current="page">Getting Started</li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="searchbox"></div>
|
|
<article class="bd-article" role="main">
|
|
|
|
<section id="getting-started">
|
|
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this heading">#</a></h1>
|
|
<section id="installation">
|
|
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this heading">#</a></h2>
|
|
<p>Python 3.8+ is required.</p>
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>smallpond
|
|
</pre></div>
|
|
</div>
|
|
</section>
|
|
<section id="initialization">
|
|
<h2>Initialization<a class="headerlink" href="#initialization" title="Permalink to this heading">#</a></h2>
|
|
<p>The first step is to initialize the smallpond session:</p>
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span><span class="w"> </span><span class="nn">smallpond</span>
|
|
|
|
<span class="n">sp</span> <span class="o">=</span> <span class="n">smallpond</span><span class="o">.</span><span class="n">init</span><span class="p">()</span>
|
|
</pre></div>
|
|
</div>
|
|
</section>
|
|
<section id="loading-data">
|
|
<h2>Loading Data<a class="headerlink" href="#loading-data" title="Permalink to this heading">#</a></h2>
|
|
<p>Create a DataFrame from a set of files:</p>
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">df</span> <span class="o">=</span> <span class="n">sp</span><span class="o">.</span><span class="n">read_parquet</span><span class="p">(</span><span class="s2">"path/to/dataset/*.parquet"</span><span class="p">)</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>To learn more about loading data, please refer to <a class="reference internal" href="api/dataframe.html#loading-data"><span class="std std-ref">Loading Data</span></a>.</p>
|
|
</section>
|
|
<section id="partitioning-data">
|
|
<h2>Partitioning Data<a class="headerlink" href="#partitioning-data" title="Permalink to this heading">#</a></h2>
|
|
<p>Smallpond requires users to manually specify data partitions for now.</p>
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">repartition</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># repartition by files</span>
|
|
<span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">repartition</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">by_row</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="c1"># repartition by rows</span>
|
|
<span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">repartition</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">hash_by</span><span class="o">=</span><span class="s2">"host"</span><span class="p">)</span> <span class="c1"># repartition by hash of column</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>To learn more about partitioning data, please refer to <a class="reference internal" href="api/dataframe.html#partitioning-data"><span class="std std-ref">Partitioning Data</span></a>.</p>
|
|
</section>
|
|
<section id="transforming-data">
|
|
<h2>Transforming Data<a class="headerlink" href="#transforming-data" title="Permalink to this heading">#</a></h2>
|
|
<p>Apply python functions or SQL expressions to transform data.</p>
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">map</span><span class="p">(</span><span class="s1">'a + b as c'</span><span class="p">)</span>
|
|
<span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">row</span><span class="p">:</span> <span class="p">{</span><span class="s1">'c'</span><span class="p">:</span> <span class="n">row</span><span class="p">[</span><span class="s1">'a'</span><span class="p">]</span> <span class="o">+</span> <span class="n">row</span><span class="p">[</span><span class="s1">'b'</span><span class="p">]})</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>To learn more about transforming data, please refer to <a class="reference internal" href="api/dataframe.html#transformations"><span class="std std-ref">Transformations</span></a>.</p>
|
|
</section>
|
|
<section id="saving-data">
|
|
<h2>Saving Data<a class="headerlink" href="#saving-data" title="Permalink to this heading">#</a></h2>
|
|
<p>Save the transformed data to a set of files:</p>
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">df</span><span class="o">.</span><span class="n">write_parquet</span><span class="p">(</span><span class="s2">"path/to/output"</span><span class="p">)</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>To learn more about saving data, please refer to <a class="reference internal" href="api/dataframe.html#consuming-data"><span class="std std-ref">Consuming Data</span></a>.</p>
|
|
</section>
|
|
<section id="monitoring">
|
|
<h2>Monitoring<a class="headerlink" href="#monitoring" title="Permalink to this heading">#</a></h2>
|
|
<p>Smallpond uses <a class="reference external" href="https://docs.ray.io/en/latest/ray-core/walkthrough.html">Ray Core</a> as the task scheduler. You can use <a class="reference external" href="https://docs.ray.io/en/latest/ray-observability/getting-started.html">Ray Dashboard</a> to monitor the task execution.</p>
|
|
<p>When smallpond starts, it will print the Ray Dashboard URL:</p>
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>...<span class="w"> </span>Started<span class="w"> </span>a<span class="w"> </span><span class="nb">local</span><span class="w"> </span>Ray<span class="w"> </span>instance.<span class="w"> </span>View<span class="w"> </span>the<span class="w"> </span>dashboard<span class="w"> </span>at<span class="w"> </span>http://127.0.0.1:8008
|
|
</pre></div>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="prev-next-footer">
|
|
|
|
<div class="prev-next-area">
|
|
<a class="left-prev"
|
|
href="index.html"
|
|
title="previous page">
|
|
<i class="fa-solid fa-angle-left"></i>
|
|
<div class="prev-next-info">
|
|
<p class="prev-next-subtitle">previous</p>
|
|
<p class="prev-next-title">smallpond</p>
|
|
</div>
|
|
</a>
|
|
<a class="right-next"
|
|
href="internals.html"
|
|
title="next page">
|
|
<div class="prev-next-info">
|
|
<p class="prev-next-subtitle">next</p>
|
|
<p class="prev-next-title">Internals</p>
|
|
</div>
|
|
<i class="fa-solid fa-angle-right"></i>
|
|
</a>
|
|
</div>
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">
|
|
|
|
<div class="sidebar-secondary-item">
|
|
|
|
<div class="page-toc tocsection onthispage">
|
|
<i class="fa-solid fa-list"></i> On this page
|
|
</div>
|
|
<nav class="bd-toc-nav page-toc">
|
|
<ul class="visible nav section-nav flex-column">
|
|
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#installation">Installation</a></li>
|
|
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#initialization">Initialization</a></li>
|
|
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#loading-data">Loading Data</a></li>
|
|
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#partitioning-data">Partitioning Data</a></li>
|
|
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#transforming-data">Transforming Data</a></li>
|
|
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#saving-data">Saving Data</a></li>
|
|
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#monitoring">Monitoring</a></li>
|
|
</ul>
|
|
</nav></div>
|
|
|
|
<div class="sidebar-secondary-item">
|
|
|
|
<div class="tocsection sourcelink">
|
|
<a href="_sources/getstarted.rst.txt">
|
|
<i class="fa-solid fa-file-lines"></i> Show Source
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div></div>
|
|
|
|
|
|
</div>
|
|
<footer class="bd-footer-content">
|
|
|
|
</footer>
|
|
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Scripts loaded after <body> so the DOM is not blocked -->
|
|
<script src="_static/scripts/bootstrap.js?digest=5b4479735964841361fd"></script>
|
|
<script src="_static/scripts/pydata-sphinx-theme.js?digest=5b4479735964841361fd"></script>
|
|
|
|
<footer class="bd-footer">
|
|
<div class="bd-footer__inner bd-page-width">
|
|
|
|
<div class="footer-items__start">
|
|
|
|
<div class="footer-item">
|
|
|
|
<p class="copyright">
|
|
|
|
© Copyright 2025, deepseek.
|
|
<br/>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
<div class="footer-item">
|
|
|
|
<p class="sphinx-version">
|
|
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.1.2.
|
|
<br/>
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="footer-items__end">
|
|
|
|
<div class="footer-item">
|
|
<p class="theme-version">
|
|
Built with the <a href="https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html">PyData Sphinx Theme</a> 0.14.4.
|
|
</p></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</footer>
|
|
</body>
|
|
</html> |