<!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>Build task — python-copr 1.63 documentation</title> <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/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="index" title="Index" href="../../genindex.html" /> <link rel="search" title="Search" href="../../search.html" /> <link rel="next" title="Mock chroot" href="mock_chroot.html" /> <link rel="prev" title="Build" href="build.html" /> </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"> python-copr </a> <div class="version"> 1.63 </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="../../installation.html">Installation</a></li> </ul> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../../ClientV1.html">Legacy client</a></li> <li class="toctree-l1 current"><a class="reference internal" href="../../ClientV2.html">Client version 2</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="../initialization.html">Client initialization</a></li> <li class="toctree-l2"><a class="reference internal" href="../resources_usage.html">Resources</a></li> <li class="toctree-l2"><a class="reference internal" href="../errors.html">Error handling</a></li> <li class="toctree-l2 current"><a class="reference internal" href="../../ClientV2.html#resources-info">Resources info</a><ul class="current"> <li class="toctree-l3"><a class="reference internal" href="project.html">Project</a></li> <li class="toctree-l3"><a class="reference internal" href="project_chroot.html">Project chroot</a></li> <li class="toctree-l3"><a class="reference internal" href="build.html">Build</a></li> <li class="toctree-l3 current"><a class="current reference internal" href="#">Build task</a><ul> <li class="toctree-l4"><a class="reference internal" href="#build-task-entity-attributes">Build task entity attributes</a></li> <li class="toctree-l4"><a class="reference internal" href="#get-build-tasks-list">Get build tasks list</a></li> <li class="toctree-l4"><a class="reference internal" href="#get-single-build-task">Get single build task</a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="mock_chroot.html">Mock chroot</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="../../ClientV2.html#autodoc">Autodoc</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../../ClientV3.html">Client version 3</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">python-copr</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="../../ClientV2.html">Client version 2</a> »</li> <li>Build task</li> <li class="wy-breadcrumbs-aside"> <a href="../../_sources/client_v2/resource_info/build_task.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="build-task"> <span id="build-task-info"></span><h1>Build task<a class="headerlink" href="#build-task" title="Permalink to this headline">¶</a></h1> <p>Build task represents information about individual build tasks. One task is responsible for one chroot.</p> <p>Access to the build tasks is done through <a class="reference internal" href="../general.html#copr.client_v2.client.CoprClient.build_tasks" title="copr.client_v2.client.CoprClient.build_tasks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">build_tasks()</span></code></a>. property of initialized <a class="reference internal" href="../general.html#copr.client_v2.client.CoprClient" title="copr.client_v2.client.CoprClient"><code class="xref py py-class docutils literal notranslate"><span class="pre">CoprClient</span></code></a>. That property is an instance of <a class="reference internal" href="../handlers.html#copr.client_v2.handlers.BuildTaskHandle" title="copr.client_v2.handlers.BuildTaskHandle"><code class="xref py py-class docutils literal notranslate"><span class="pre">BuildTaskHandle</span></code></a>.</p> <p>It may be more convenient to access build tasks in context of a build using method <a class="reference internal" href="../resources.html#copr.client_v2.resources.Build.get_build_tasks" title="copr.client_v2.resources.Build.get_build_tasks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_build_tasks()</span></code></a> of access build tasks in context of a project using method <a class="reference internal" href="../resources.html#copr.client_v2.resources.Project.get_build_tasks" title="copr.client_v2.resources.Project.get_build_tasks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_build_tasks()</span></code></a></p> <p>Build tasks are represented by <a class="reference internal" href="../resources.html#copr.client_v2.resources.BuildTask" title="copr.client_v2.resources.BuildTask"><code class="xref py py-class docutils literal notranslate"><span class="pre">BuildTask</span></code></a> class.</p> <div class="section" id="build-task-entity-attributes"> <span id="build-task-attributes"></span><h2>Build task entity attributes<a class="headerlink" href="#build-task-entity-attributes" title="Permalink to this headline">¶</a></h2> <table border="1" class="docutils"> <colgroup> <col width="20%" /> <col width="22%" /> <col width="58%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Field</th> <th class="head">Type</th> <th class="head">Description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>chroot_name</td> <td>str</td> <td>chroot name</td> </tr> <tr class="row-odd"><td>build_id</td> <td>int</td> <td>unique build identifier</td> </tr> <tr class="row-even"><td>state</td> <td>str</td> <td>current build task state</td> </tr> <tr class="row-odd"><td>started_on</td> <td>int(unixtime UTC)</td> <td>time when the build chroot started</td> </tr> <tr class="row-even"><td>ended_on</td> <td>int(unixtime UTC)</td> <td>time when the build chroot ended</td> </tr> <tr class="row-odd"><td>git_hash</td> <td>str</td> <td>hash of the git commit in dist-git used for the build</td> </tr> <tr class="row-even"><td>result_dir_url</td> <td>str(URL)</td> <td>location of the build results</td> </tr> </tbody> </table> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">Build Task doesn’t currently support any modifications, so all fields are read-only.</p> </div> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">all following examples assume that we use <code class="docutils literal notranslate"><span class="pre">cl</span></code> as an instance of <a class="reference internal" href="../general.html#copr.client_v2.client.CoprClient" title="copr.client_v2.client.CoprClient"><code class="xref py py-class docutils literal notranslate"><span class="pre">client_v2.client.CoprClient</span></code></a>, <code class="docutils literal notranslate"><span class="pre">p</span></code> as an instance of <a class="reference internal" href="../resources.html#copr.client_v2.resources.Project" title="copr.client_v2.resources.Project"><code class="xref py py-class docutils literal notranslate"><span class="pre">Project</span></code></a>, <code class="docutils literal notranslate"><span class="pre">b</span></code> as an instance of <a class="reference internal" href="../resources.html#copr.client_v2.resources.Build" title="copr.client_v2.resources.Build"><code class="xref py py-class docutils literal notranslate"><span class="pre">Build</span></code></a>,</p> </div> </div> <div class="section" id="get-build-tasks-list"> <h2>Get build tasks list<a class="headerlink" href="#get-build-tasks-list" title="Permalink to this headline">¶</a></h2> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">bt_list_1</span> <span class="o">=</span> <span class="n">cl</span><span class="o">.</span><span class="n">build_tasks</span><span class="o">.</span><span class="n">get_list</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="n">BuildStateValues</span><span class="o">.</span><span class="n">FAILED</span><span class="p">,</span> <span class="n">limit</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> <span class="gp">>>> </span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">bt_list_1</span><span class="p">)</span> <span class="go">['<Build task #17-fedora-18-x86_64, state: failed>',</span> <span class="go"> '<Build task #17-fedora-18-i386, state: failed>',</span> <span class="go"> '<Build task #17-fedora-19-x86_64, state: failed>',</span> <span class="go"> '<Build task #17-fedora-19-i386, state: failed>',</span> <span class="go"> '<Build task #107850-fedora-23-x86_64, state: failed>']</span> <span class="go"># using project object</span> <span class="gp">>>> </span><span class="n">bt_list_2</span> <span class="o">=</span> <span class="n">p</span><span class="o">.</span><span class="n">get_build_tasks</span><span class="p">(</span><span class="n">limit</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> <span class="gp">>>> </span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">bt_list_2</span><span class="p">)</span> <span class="go">['<Build task #86705-epel-6-i386, state: succeeded>',</span> <span class="go"> '<Build task #86705-epel-6-x86_64, state: failed>',</span> <span class="go"> '<Build task #86705-fedora-rawhide-x86_64, state: succeeded>',</span> <span class="go"> '<Build task #86705-fedora-rawhide-i386, state: failed>',</span> <span class="go"> '<Build task #86705-fedora-20-x86_64, state: succeeded>']</span> <span class="go"># using build object</span> <span class="gp">>>> </span><span class="n">bt_list_3</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">get_build_tasks</span><span class="p">(</span><span class="n">limit</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> <span class="gp">>>> </span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">bt_list_3</span><span class="p">)</span> <span class="go">['<Build task #87165-epel-6-i386, state: failed>',</span> <span class="go"> '<Build task #87165-epel-6-x86_64, state: failed>',</span> <span class="go"> '<Build task #87165-fedora-rawhide-x86_64, state: succeeded>',</span> <span class="go"> '<Build task #87165-fedora-rawhide-i386, state: succeeded>',</span> <span class="go"> '<Build task #87165-fedora-20-x86_64, state: succeeded>']</span> </pre></div> </div> </div> <div class="section" id="get-single-build-task"> <h2>Get single build task<a class="headerlink" href="#get-single-build-task" title="Permalink to this headline">¶</a></h2> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">bt</span> <span class="o">=</span> <span class="n">cl</span><span class="o">.</span><span class="n">build_tasks</span><span class="o">.</span><span class="n">get_one</span><span class="p">(</span><span class="mi">106897</span><span class="p">,</span> <span class="s2">"epel-6-i386"</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">bt</span><span class="o">.</span><span class="n">state</span><span class="p">,</span> <span class="n">bt</span><span class="o">.</span><span class="n">result_dir_url</span><span class="p">)</span> <span class="go">(u'succeeded', u'http://copr-be-dev.cloud.fedoraproject.org/results/rineau/libQGLViewer-qt5/epel-6-i386/libQGLViewer-2.5.1-5.fc21')</span> </pre></div> </div> </div> </div> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="mock_chroot.html" class="btn btn-neutral float-right" title="Mock chroot" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="build.html" class="btn btn-neutral float-left" title="Build" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 2018, Red Hat, Inc. </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>. </footer> </div> </div> </section> </div> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>