| |
| |
| <!-- |
| Javascript to render AIRFLOW-XXX and PR references in text |
| as HTML links. |
| |
| Overrides extrahead block from sphinx_rtd_theme |
| https://www.sphinx-doc.org/en/master/templating.html |
| --> |
| |
| |
| <!DOCTYPE html> |
| <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> |
| <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> |
| <head> |
| <meta charset="utf-8"> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <title>airflow.contrib.operators.mlengine_operator — Airflow Documentation</title> |
| |
| |
| |
| |
| <link rel="shortcut icon" href="../../../../../_static/pin_32.png"/> |
| |
| |
| |
| |
| |
| <script type="text/javascript" src="../../../../../_static/js/modernizr.min.js"></script> |
| |
| |
| <script type="text/javascript" id="documentation_options" data-url_root="../../../../../" src="../../../../../_static/documentation_options.js"></script> |
| <script type="text/javascript" src="../../../../../_static/jquery.js"></script> |
| <script type="text/javascript" src="../../../../../_static/underscore.js"></script> |
| <script type="text/javascript" src="../../../../../_static/doctools.js"></script> |
| <script type="text/javascript" src="../../../../../_static/language_data.js"></script> |
| <script type="text/javascript" src="../../../../../_static/jira-links.js"></script> |
| |
| <script type="text/javascript" src="../../../../../_static/js/theme.js"></script> |
| |
| |
| |
| |
| <link rel="stylesheet" href="../../../../../_static/css/theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../../../_static/graphviz.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../../../_static/exampleinclude.css" type="text/css" /> |
| <link rel="index" title="Index" href="../../../../../genindex.html" /> |
| <link rel="search" title="Search" href="../../../../../search.html" /> |
| <link rel="next" title="airflow.contrib.operators.mongo_to_s3" href="../mongo_to_s3/index.html" /> |
| <link rel="prev" title="airflow.contrib.operators.kubernetes_pod_operator" href="../kubernetes_pod_operator/index.html" /> |
| |
| <script> |
| </script> |
| <style> |
| |
| </style> |
| |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| |
| |
| <div class="wy-grid-for-nav"> |
| |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| |
| |
| <a href="../../../../../index.html" class="icon icon-home"> Airflow |
| |
| |
| |
| </a> |
| |
| |
| |
| |
| <div class="version"> |
| 1.10.8 |
| </div> |
| |
| |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../../../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| |
| </div> |
| |
| <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
| |
| |
| |
| |
| |
| |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../project.html">Project</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../license.html">License</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../start.html">Quick Start</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../installation.html">Installation</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../tutorial.html">Tutorial</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../howto/index.html">How-to Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../ui.html">UI / Screenshots</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../concepts.html">Concepts</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../profiling.html">Data Profiling</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../cli.html">Command Line Interface Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../scheduler.html">Scheduling & Triggers</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../executor/index.html">Executor</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../plugins.html">Plugins</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../security.html">Security</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../timezone.html">Time zones</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../api.html">REST API Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../integration.html">Integration</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../metrics.html">Metrics</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../errors.html">Error Tracking</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../kubernetes.html">Kubernetes</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../lineage.html">Lineage</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../dag-serialization.html">DAG Serialization</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../changelog.html">Changelog</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../best-practices.html">Best Practices</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../faq.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../macros.html">Macros reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../privacy_notice.html">Privacy Notice</a></li> |
| </ul> |
| <p class="caption"><span class="caption-text">References</span></p> |
| <ul class="current"> |
| <li class="toctree-l1 current"><a class="reference internal" href="../../../../index.html">Python API</a><ul class="current"> |
| <li class="toctree-l2 current"><a class="reference internal" href="../../../../index.html#operators">Operators</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../../../../index.html#baseoperator">BaseOperator</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../../index.html#basesensoroperator">BaseSensorOperator</a></li> |
| <li class="toctree-l3 current"><a class="reference internal" href="../../../../index.html#operators-packages">Operators packages</a><ul class="current"> |
| <li class="toctree-l4"><a class="reference internal" href="../../../operators/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.operators</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.sensors</span></code></a></li> |
| <li class="toctree-l4 current"><a class="reference internal" href="../index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.sensors</span></code></a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../../index.html#hooks">Hooks</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../../index.html#executors">Executors</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../../index.html#models">Models</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../../index.html#core-and-community-package">Core and community package</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../../../configurations-ref.html">Configurations</a></li> |
| </ul> |
| |
| |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
| |
| |
| <nav class="wy-nav-top" aria-label="top navigation"> |
| |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../../../../../index.html">Airflow</a> |
| |
| </nav> |
| |
| |
| <div class="wy-nav-content"> |
| |
| <div class="rst-content"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <div role="navigation" aria-label="breadcrumbs navigation"> |
| |
| <ul class="wy-breadcrumbs"> |
| |
| <li><a href="../../../../../index.html">Docs</a> »</li> |
| |
| <li><a href="../../../../index.html">Python API Reference</a> »</li> |
| |
| <li><a href="../index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators</span></code></a> »</li> |
| |
| <li><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators.mlengine_operator</span></code></li> |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../../../../../_sources/_api/airflow/contrib/operators/mlengine_operator/index.rst.txt" rel="nofollow"> View page source</a> |
| |
| |
| </li> |
| |
| </ul> |
| |
| |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <div class="section" id="module-airflow.contrib.operators.mlengine_operator"> |
| <span id="airflow-contrib-operators-mlengine-operator"></span><h1><a class="reference internal" href="#module-airflow.contrib.operators.mlengine_operator" title="airflow.contrib.operators.mlengine_operator"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators.mlengine_operator</span></code></a><a class="headerlink" href="#module-airflow.contrib.operators.mlengine_operator" title="Permalink to this headline">¶</a></h1> |
| <div class="section" id="module-contents"> |
| <h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline">¶</a></h2> |
| <dl class="data"> |
| <dt id="airflow.contrib.operators.mlengine_operator.log"> |
| <code class="sig-prename descclassname">airflow.contrib.operators.mlengine_operator.</code><code class="sig-name descname">log</code><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.log" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| <dl class="function"> |
| <dt id="airflow.contrib.operators.mlengine_operator._normalize_mlengine_job_id"> |
| <code class="sig-prename descclassname">airflow.contrib.operators.mlengine_operator.</code><code class="sig-name descname">_normalize_mlengine_job_id</code><span class="sig-paren">(</span><em class="sig-param">job_id</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#_normalize_mlengine_job_id"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator._normalize_mlengine_job_id" title="Permalink to this definition">¶</a></dt> |
| <dt> |
| <code class="sig-name descname">Replaces invalid MLEngine job_id characters with '_'.</code></dt> |
| <dd><p>This also adds a leading ‘z’ in case job_id starts with an invalid |
| character.</p> |
| <dl class="simple"> |
| <dt>Args:</dt><dd><p>job_id: A job_id str that may have invalid characters.</p> |
| </dd> |
| <dt>Returns:</dt><dd><p>A valid job_id representation.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineBatchPredictionOperator"> |
| <em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.mlengine_operator.</code><code class="sig-name descname">MLEngineBatchPredictionOperator</code><span class="sig-paren">(</span><em class="sig-param">project_id</em>, <em class="sig-param">job_id</em>, <em class="sig-param">region</em>, <em class="sig-param">data_format</em>, <em class="sig-param">input_paths</em>, <em class="sig-param">output_path</em>, <em class="sig-param">model_name=None</em>, <em class="sig-param">version_name=None</em>, <em class="sig-param">uri=None</em>, <em class="sig-param">max_worker_count=None</em>, <em class="sig-param">runtime_version=None</em>, <em class="sig-param">signature_name=None</em>, <em class="sig-param">gcp_conn_id='google_cloud_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineBatchPredictionOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineBatchPredictionOperator" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <a class="reference internal" href="../../../operators/index.html#airflow.operators.BaseOperator" title="airflow.operators.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.operators.BaseOperator</span></code></a></p> |
| <p>Start a Google Cloud ML Engine prediction job.</p> |
| <p>NOTE: For model origin, users should consider exactly one from the |
| three options below:</p> |
| <ol class="arabic simple"> |
| <li><p>Populate <code class="docutils literal notranslate"><span class="pre">uri</span></code> field only, which should be a GCS location that |
| points to a tensorflow savedModel directory.</p></li> |
| <li><p>Populate <code class="docutils literal notranslate"><span class="pre">model_name</span></code> field only, which refers to an existing |
| model, and the default version of the model will be used.</p></li> |
| <li><p>Populate both <code class="docutils literal notranslate"><span class="pre">model_name</span></code> and <code class="docutils literal notranslate"><span class="pre">version_name</span></code> fields, which |
| refers to a specific version of a specific model.</p></li> |
| </ol> |
| <p>In options 2 and 3, both model and version name should contain the |
| minimal identifier. For instance, call:</p> |
| <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">MLEngineBatchPredictionOperator</span><span class="p">(</span> |
| <span class="o">...</span><span class="p">,</span> |
| <span class="n">model_name</span><span class="o">=</span><span class="s1">'my_model'</span><span class="p">,</span> |
| <span class="n">version_name</span><span class="o">=</span><span class="s1">'my_version'</span><span class="p">,</span> |
| <span class="o">...</span><span class="p">)</span> |
| </pre></div> |
| </div> |
| <p>if the desired model version is |
| <code class="docutils literal notranslate"><span class="pre">projects/my_project/models/my_model/versions/my_version</span></code>.</p> |
| <p>See <a class="reference external" href="https://cloud.google.com/ml-engine/reference/rest/v1/projects.jobs">https://cloud.google.com/ml-engine/reference/rest/v1/projects.jobs</a> |
| for further documentation on the parameters.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>project_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud project name where the |
| prediction job is submitted. (templated)</p></li> |
| <li><p><strong>job_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – A unique id for the prediction job on Google Cloud |
| ML Engine. (templated)</p></li> |
| <li><p><strong>data_format</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The format of the input data. |
| It will default to ‘DATA_FORMAT_UNSPECIFIED’ if is not provided |
| or is not one of [“TEXT”, “TF_RECORD”, “TF_RECORD_GZIP”].</p></li> |
| <li><p><strong>input_paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.8)"><em>list</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a><em>]</em>) – A list of GCS paths of input data for batch |
| prediction. Accepting wildcard operator <code class="docutils literal notranslate"><span class="pre">*</span></code>, but only at the end. (templated)</p></li> |
| <li><p><strong>output_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The GCS path where the prediction results are |
| written to. (templated)</p></li> |
| <li><p><strong>region</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Compute Engine region to run the |
| prediction job in. (templated)</p></li> |
| <li><p><strong>model_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud ML Engine model to use for prediction. |
| If version_name is not provided, the default version of this |
| model will be used. |
| Should not be None if version_name is provided. |
| Should be None if uri is provided. (templated)</p></li> |
| <li><p><strong>version_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud ML Engine model version to use for |
| prediction. |
| Should be None if uri is provided. (templated)</p></li> |
| <li><p><strong>uri</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The GCS path of the saved model to use for prediction. |
| Should be None if model_name is provided. |
| It should be a GCS path pointing to a tensorflow SavedModel. (templated)</p></li> |
| <li><p><strong>max_worker_count</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.8)"><em>int</em></a>) – The maximum number of workers to be used |
| for parallel processing. Defaults to 10 if not specified.</p></li> |
| <li><p><strong>runtime_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud ML Engine runtime version to use |
| for batch prediction.</p></li> |
| <li><p><strong>signature_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The name of the signature defined in the SavedModel |
| to use for this job.</p></li> |
| <li><p><strong>gcp_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The connection ID used for connection to Google |
| Cloud Platform.</p></li> |
| <li><p><strong>delegate_to</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The account to impersonate, if any. |
| For this to work, the service account making the request must |
| have domain-wide delegation enabled.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Raises</dt> |
| <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">ValueError</span></code>: if a unique model/version origin cannot be |
| determined.</p> |
| </dd> |
| </dl> |
| <dl class="attribute"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineBatchPredictionOperator.template_fields"> |
| <code class="sig-name descname">template_fields</code><em class="property"> = ['_project_id', '_job_id', '_region', '_input_paths', '_output_path', '_model_name', '_version_name', '_uri']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineBatchPredictionOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineBatchPredictionOperator.template_fields" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| <dl class="method"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineBatchPredictionOperator.execute"> |
| <code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineBatchPredictionOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineBatchPredictionOperator.execute" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineModelOperator"> |
| <em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.mlengine_operator.</code><code class="sig-name descname">MLEngineModelOperator</code><span class="sig-paren">(</span><em class="sig-param">project_id</em>, <em class="sig-param">model</em>, <em class="sig-param">operation='create'</em>, <em class="sig-param">gcp_conn_id='google_cloud_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineModelOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineModelOperator" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <a class="reference internal" href="../../../operators/index.html#airflow.operators.BaseOperator" title="airflow.operators.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.operators.BaseOperator</span></code></a></p> |
| <p>Operator for managing a Google Cloud ML Engine model.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>project_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud project name to which MLEngine |
| model belongs. (templated)</p></li> |
| <li><p><strong>model</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.8)"><em>dict</em></a>) – <p>A dictionary containing the information about the model. |
| If the <cite>operation</cite> is <cite>create</cite>, then the <cite>model</cite> parameter should |
| contain all the information about this model such as <cite>name</cite>.</p> |
| <p>If the <cite>operation</cite> is <cite>get</cite>, the <cite>model</cite> parameter |
| should contain the <cite>name</cite> of the model.</p> |
| </p></li> |
| <li><p><strong>operation</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – <p>The operation to perform. Available operations are:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">create</span></code>: Creates a new model as provided by the <cite>model</cite> parameter.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">get</span></code>: Gets a particular model where the name is specified in <cite>model</cite>.</p></li> |
| </ul> |
| </p></li> |
| <li><p><strong>gcp_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The connection ID to use when fetching connection info.</p></li> |
| <li><p><strong>delegate_to</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The account to impersonate, if any. |
| For this to work, the service account making the request must have |
| domain-wide delegation enabled.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="attribute"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineModelOperator.template_fields"> |
| <code class="sig-name descname">template_fields</code><em class="property"> = ['_model']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineModelOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineModelOperator.template_fields" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| <dl class="method"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineModelOperator.execute"> |
| <code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineModelOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineModelOperator.execute" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineVersionOperator"> |
| <em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.mlengine_operator.</code><code class="sig-name descname">MLEngineVersionOperator</code><span class="sig-paren">(</span><em class="sig-param">project_id</em>, <em class="sig-param">model_name</em>, <em class="sig-param">version_name=None</em>, <em class="sig-param">version=None</em>, <em class="sig-param">operation='create'</em>, <em class="sig-param">gcp_conn_id='google_cloud_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineVersionOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineVersionOperator" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <a class="reference internal" href="../../../operators/index.html#airflow.operators.BaseOperator" title="airflow.operators.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.operators.BaseOperator</span></code></a></p> |
| <p>Operator for managing a Google Cloud ML Engine version.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>project_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud project name to which MLEngine |
| model belongs.</p></li> |
| <li><p><strong>model_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The name of the Google Cloud ML Engine model that the version |
| belongs to. (templated)</p></li> |
| <li><p><strong>version_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – A name to use for the version being operated upon. |
| If not None and the <cite>version</cite> argument is None or does not have a value for |
| the <cite>name</cite> key, then this will be populated in the payload for the |
| <cite>name</cite> key. (templated)</p></li> |
| <li><p><strong>version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.8)"><em>dict</em></a>) – A dictionary containing the information about the version. |
| If the <cite>operation</cite> is <cite>create</cite>, <cite>version</cite> should contain all the |
| information about this version such as name, and deploymentUrl. |
| If the <cite>operation</cite> is <cite>get</cite> or <cite>delete</cite>, the <cite>version</cite> parameter |
| should contain the <cite>name</cite> of the version. |
| If it is None, the only <cite>operation</cite> possible would be <cite>list</cite>. (templated)</p></li> |
| <li><p><strong>operation</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – <p>The operation to perform. Available operations are:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">create</span></code>: Creates a new version in the model specified by <cite>model_name</cite>, |
| in which case the <cite>version</cite> parameter should contain all the |
| information to create that version |
| (e.g. <cite>name</cite>, <cite>deploymentUrl</cite>).</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">get</span></code>: Gets full information of a particular version in the model |
| specified by <cite>model_name</cite>. |
| The name of the version should be specified in the <cite>version</cite> |
| parameter.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">list</span></code>: Lists all available versions of the model specified |
| by <cite>model_name</cite>.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">delete</span></code>: Deletes the version specified in <cite>version</cite> parameter from the |
| model specified by <cite>model_name</cite>). |
| The name of the version should be specified in the <cite>version</cite> |
| parameter.</p></li> |
| </ul> |
| </p></li> |
| <li><p><strong>gcp_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The connection ID to use when fetching connection info.</p></li> |
| <li><p><strong>delegate_to</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The account to impersonate, if any. |
| For this to work, the service account making the request must have |
| domain-wide delegation enabled.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="attribute"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineVersionOperator.template_fields"> |
| <code class="sig-name descname">template_fields</code><em class="property"> = ['_model_name', '_version_name', '_version']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineVersionOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineVersionOperator.template_fields" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| <dl class="method"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineVersionOperator.execute"> |
| <code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineVersionOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineVersionOperator.execute" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineTrainingOperator"> |
| <em class="property">class </em><code class="sig-prename descclassname">airflow.contrib.operators.mlengine_operator.</code><code class="sig-name descname">MLEngineTrainingOperator</code><span class="sig-paren">(</span><em class="sig-param">project_id</em>, <em class="sig-param">job_id</em>, <em class="sig-param">package_uris</em>, <em class="sig-param">training_python_module</em>, <em class="sig-param">training_args</em>, <em class="sig-param">region</em>, <em class="sig-param">scale_tier=None</em>, <em class="sig-param">master_type=None</em>, <em class="sig-param">runtime_version=None</em>, <em class="sig-param">python_version=None</em>, <em class="sig-param">job_dir=None</em>, <em class="sig-param">gcp_conn_id='google_cloud_default'</em>, <em class="sig-param">delegate_to=None</em>, <em class="sig-param">mode='PRODUCTION'</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineTrainingOperator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineTrainingOperator" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <a class="reference internal" href="../../../operators/index.html#airflow.operators.BaseOperator" title="airflow.operators.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">airflow.operators.BaseOperator</span></code></a></p> |
| <p>Operator for launching a MLEngine training job.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>project_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud project name within which MLEngine |
| training job should run (templated).</p></li> |
| <li><p><strong>job_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – A unique templated id for the submitted Google MLEngine |
| training job. (templated)</p></li> |
| <li><p><strong>package_uris</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – A list of package locations for MLEngine training job, |
| which should include the main training program + any additional |
| dependencies. (templated)</p></li> |
| <li><p><strong>training_python_module</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Python module name to run within MLEngine |
| training job after installing ‘package_uris’ packages. (templated)</p></li> |
| <li><p><strong>training_args</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – A list of templated command line arguments to pass to |
| the MLEngine training program. (templated)</p></li> |
| <li><p><strong>region</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Compute Engine region to run the MLEngine training |
| job in (templated).</p></li> |
| <li><p><strong>scale_tier</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – Resource tier for MLEngine training job. (templated)</p></li> |
| <li><p><strong>master_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – Cloud ML Engine machine name. |
| Must be set when scale_tier is CUSTOM. (templated)</p></li> |
| <li><p><strong>runtime_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The Google Cloud ML runtime version to use for |
| training. (templated)</p></li> |
| <li><p><strong>python_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The version of Python used in training. (templated)</p></li> |
| <li><p><strong>job_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – A Google Cloud Storage path in which to store training |
| outputs and other data needed for training. (templated)</p></li> |
| <li><p><strong>gcp_conn_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The connection ID to use when fetching connection info.</p></li> |
| <li><p><strong>delegate_to</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – The account to impersonate, if any. |
| For this to work, the service account making the request must have |
| domain-wide delegation enabled.</p></li> |
| <li><p><strong>mode</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><em>str</em></a>) – Can be one of ‘DRY_RUN’/’CLOUD’. In ‘DRY_RUN’ mode, no real |
| training job will be launched, but the MLEngine training job request |
| will be printed out. In ‘CLOUD’ mode, a real MLEngine training job |
| creation request will be issued.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="attribute"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineTrainingOperator.template_fields"> |
| <code class="sig-name descname">template_fields</code><em class="property"> = ['_project_id', '_job_id', '_package_uris', '_training_python_module', '_training_args', '_region', '_scale_tier', '_master_type', '_runtime_version', '_python_version', '_job_dir']</em><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineTrainingOperator.template_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineTrainingOperator.template_fields" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| <dl class="method"> |
| <dt id="airflow.contrib.operators.mlengine_operator.MLEngineTrainingOperator.execute"> |
| <code class="sig-name descname">execute</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">context</em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../_modules/airflow/contrib/operators/mlengine_operator.html#MLEngineTrainingOperator.execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#airflow.contrib.operators.mlengine_operator.MLEngineTrainingOperator.execute" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| </dd></dl> |
| |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| |
| |
| <footer> |
| |
| <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| |
| <a href="../mongo_to_s3/index.html" class="btn btn-neutral float-right" title="airflow.contrib.operators.mongo_to_s3" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> |
| |
| |
| <a href="../kubernetes_pod_operator/index.html" class="btn btn-neutral float-left" title="airflow.contrib.operators.kubernetes_pod_operator" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> |
| |
| </div> |
| |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p> |
| |
| </p> |
| </div> |
| Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. |
| <div class="footer">This page uses <a href="https://analytics.google.com/"> |
| Google Analytics</a> to collect statistics. You can disable it by blocking |
| the JavaScript coming from www.google-analytics.com. Check our |
| <a href="../../../../../privacy_notice.html">Privacy Policy</a> |
| for more details. |
| </div> |
| |
| |
| </footer> |
| |
| </div> |
| </div> |
| |
| </section> |
| |
| </div> |
| |
| |
| |
| <script type="text/javascript"> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| |
| |
| |
| <!-- Theme Analytics --> |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-140539454-1', 'auto'); |
| ga('send', 'pageview'); |
| </script> |
| |
| |
| |
| |
| </body> |
| </html> |