# SOME DESCRIPTIVE TITLE.
# Copyright (C) 1999-2020, The Alibaba Group Holding Ltd.
# This file is distributed under the same license as the mars package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: mars 0.8.0rc1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-02 11:50+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"

#: ../../source/development/operand.rst:4
msgid "Implement a Mars Operand"
msgstr "实现 Mars 算子"

#: ../../source/development/operand.rst:6
msgid ""
"Use ``read_csv`` as an example to illustrate how to implement a Mars "
"operand."
msgstr "这篇文档里使用 ``read_csv`` 作为例子介绍如何实现一个 Mars 算子"

#: ../../source/development/operand.rst:9
msgid "Define Operand Class"
msgstr "定义算子类"

#: ../../source/development/operand.rst:11
msgid ""
"All Mars operands inherit from the base class ``Operand``, it defines the"
" basic properties of operand, each module has it's own child class, such "
"as ``DataFrameOperand``, ``TensorOperand``, etc. For tilebale operand, it"
" also needs to inherit from ``TileableOperandMixin`` to implement "
"``tile`` and ``execute`` functions. So we firstly define operand class "
"and set output types in init method, the types could be DataFrame or "
"Tensor which depends on the type of operand's output data, ``__call__`` "
"method is also needed for creating a Mars dataframe."
msgstr ""
"所有的 Mars 算子都继承自基类 ``Operand``，基类里定义了算子的基本属性，在每个大模块里都实现了对应的子类，比如 "
"``DataFrameOperand``、 ``TensorOperand`` 等。对于一个可以被 tile 的算子，它还需要继承 "
"``TileableOperandMixin`` 用以实现 ``tile`` 、``execute`` "
"等必要的方法。所以首先我们可以先定义好算子类和它的初始化方法，指定算子的输出类型，并且在 ``__call__`` 函数里定义好创建 Mars "
"DataFrame 的逻辑。"

#: ../../source/development/operand.rst:47
msgid ""
"For the ``SimpleReadCSV`` operand, the property ``path`` means the path "
"of csv file, we use a ``StringField`` to indicate the property's type "
"which is useful for serialization. If the type is uncertain, ``AnyField``"
" will work."
msgstr ""
"对于 ``SimpleReadCSV`` 算子，类持有的 ``path`` 属性记录 csv 的文件地址，这里使用 ``StringField`` "
"表示改属性的类型是字符串，指定类型主要是为了方便序列化算子，如果某个属性的类型是不确定的，可以用 ``AnyField`` 表示。"

#: ../../source/development/operand.rst:52
msgid "Implement Tile Method"
msgstr "实现 tile 方法"

#: ../../source/development/operand.rst:54
msgid ""
"Tile method is the next goal, this method will split the computing task "
"into several sub tasks. Ideally, these tasks can be assigned on different"
" executors in parallel. In the specific case of ``read_csv``, each sub "
"task read a block of bytes from the file, so we need calculate the offset"
" and length of each block in the tile function. As we use the same class "
"for both coarse-grained and fine-grained operand, ``offset``, ``length`` "
"and other properties are added to record information for fine-grained "
"operand."
msgstr ""
"接下来需要实现 Tile 方法， "
"这个函数里主要是将该算子的计算任务分解成多个子任务。理想情况下，这些子任务可以并行的分发到不同的执行器中执行。对于当前的 ``read_csv``"
" 计算任务，每个子任务需要读取文件的不同块，所以在 tile "
"函数里我们需要计算出每个子任务读取文件块的偏移值以及读取长度。由于粗粒度算子与细粒度算子都使用同一个算子类表示，所以需要在刚刚定义好的算子中添加 "
"``offset``、``length`` 等属性记录细粒度算子需要的一些信息。"

#: ../../source/development/operand.rst:138
msgid "Implement Execute Method"
msgstr "实现 execute 方法"

#: ../../source/development/operand.rst:140
msgid ""
"When sub task is delivered to executor, Mars will call operand's execute "
"method to perform calculations. When it comes to ``read_csv``, we need "
"read the block from the file according to the ``offset`` and ``length``, "
"however the ``offset`` is a rough position as we can't read a csv file "
"from the middle of a line, using ``readline`` to find the starts and ends"
" at delimiter boundaries."
msgstr ""
"当拆分好的子任务被分发到执行器时，Mars 会调用算子的 ``execute`` 方法来做计算，对于 ``read_csv`` "
"的子任务，在函数里需要根据 ``offset`` 和 ``length`` 读取对应的数据块，但是这两个值只是一个粗略的值，因为 csv "
"文件不能从一行的中间读取，所以每次执行的时候需要计算出分隔符所在的起始位置。"

#: ../../source/development/operand.rst:190
msgid ""
"After reading the chunk data by ``pd.read_csv``, we store the results in "
"``ctx``. ``SimpleReadCSV`` only has one output here, for operand like "
"``SVD`` that has multiple outputs, we can store them separately using "
"output's keys."
msgstr ""
"当我们通过 ``pd.read_csv`` 读取当前数据块后，可以将读到的数据存储在 ``ctx`` 中，这里 ``SimpleReadCSV``"
" 只有一个输出，对于 ``SVD`` 这样有多个输出的算子，可以通过outputs 不同的 key 存储对应的输出数据。"

#: ../../source/development/operand.rst:195
msgid "Define User Interface"
msgstr "定义用户接口"

#: ../../source/development/operand.rst:197
msgid ""
"Finally, we need define function ``read_csv`` exposed to users. In this "
"function, besides creating a ``SimpleReadCSV`` operand, a sample data is "
"taken to infer some meta information of Mars DataFrame, such as dtypes, "
"columns, index, etc."
msgstr ""
"最后，需要定义一个暴露给用户的函数接口 ``read_csv``。在这个函数里，我们需要创建 ``SimpleReadCSV`` "
"算子，并且需要读取一小块采样数据，推断出输出的 DataFrame 的dtypes, columns, index 等元信息。"

#: ../../source/development/operand.rst:223
msgid "Write Tests"
msgstr "编写测试用例"

#: ../../source/development/operand.rst:225
msgid ""
"Mars uses pytest for testing, we can add tests under the ``tests`` "
"subdirectory of the specific module and follow the current examples of "
"tests. Define a test function and use the shared fixture ``setup`` to run"
" your tests under the test environment."
msgstr ""
"Mars 使用 pytest 运行测试用例，可以参考当前模块的单元测试，在 ``tests`` 目录下添加对应的用例。在测试函数里，需要使用共享的"
" fixture ``setup`` 来使得你的测试跑在测试环境中。"

#: ../../source/development/operand.rst:244
msgid ""
"When tests pass locally, we can submit a pull requests on GitHub, the "
"test suite will run automatically on GitHub Actions and Azure Pipelines "
"continuous integration services, if all checks have passed, it means the "
"pull request is up to the quality of merging."
msgstr ""
"如果在本地测试通过，这时候我们可以在 GitHub 提交一个 pull requests，所有的测试会自动运行在 GitHub Actions 和"
" Azure Pipelines 这两个持续集成的平台上，如果所有的检测都通过了，意味着这个 pull requests 达到了合并的要求。"

#: ../../source/development/operand.rst:250
msgid "Documenting Your Code"
msgstr "添加文档"

#: ../../source/development/operand.rst:252
msgid ""
"If the changes add APIs to Mars modules, we should document our code in "
"``docs`` directory, it can be done following the regarding "
":ref:`documentation <build_documentation>`."
msgstr ""
"如果代码里增加了 API，那我们需要在 ``docs`` 目录下添加说明，可以参考相关 :ref:`文档 "
"<build_documentation>` 完成。"

