Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-19430][docs-zh] Translate page datastream_tutorial into Chinese #13498

Merged
merged 3 commits into from
Sep 30, 2020

Conversation

wangxlong
Copy link
Contributor

What is the purpose of the change

Translate page datastream_tutorial into Chinese

Brief change log

Translate page datastream_tutorial into Chinese, The doc is located at /dev/python/user-guide/datastream_tutorial.zh.md

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): ( no)
  • The serializers: (no )
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
  • The S3 file system connector: ( no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 28, 2020

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 36e941c (Fri Feb 19 07:31:47 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 28, 2020

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

@wangxlong
Copy link
Contributor Author

Hi @dianfu, Could you help have a review in your free time, Thank you~

Copy link
Contributor

@dianfu dianfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wangxlong Thanks for the PR! Have left a few comments. As most of the content of this page is similar to https://ci.apache.org/projects/flink/flink-docs-master/zh/try-flink/datastream_api.html, you can refer to it when translating this page.

If you get stuck, check out the [community support resources](https://flink.apache.org/zh/community.html).
In particular, Apache Flink's [user mailing list](https://flink.apache.org/zh/community.html#mailing-lists) consistently ranks as one of the most active of any Apache project and a great way to get help quickly.
如果你有疑惑,可以查阅 [community support resources](https://flink.apache.org/zh/community.html)
特别是,Apache Flink [user mailing list](https://flink.apache.org/zh/community.html#mailing-lists) 一直是最活跃的Apache项目之一,也是快速获得帮助的好方法。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
特别是,Apache Flink [user mailing list](https://flink.apache.org/zh/community.html#mailing-lists) 一直是最活跃的Apache项目之一,也是快速获得帮助的好方法。
特别是,Apache Flink [用户邮件列表](https://flink.apache.org/zh/community.html#mailing-lists) 一直被评为所有Apache项目中最活跃的一个,也是快速获得帮助的好方法。


If you get stuck, check out the [community support resources](https://flink.apache.org/zh/community.html).
In particular, Apache Flink's [user mailing list](https://flink.apache.org/zh/community.html#mailing-lists) consistently ranks as one of the most active of any Apache project and a great way to get help quickly.
如果你有疑惑,可以查阅 [community support resources](https://flink.apache.org/zh/community.html)。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
如果你有疑惑,可以查阅 [community support resources](https://flink.apache.org/zh/community.html)
如果你有疑惑,可以查阅 [社区支持资源](https://flink.apache.org/zh/community.html)


## How To Follow Along
## 如何跟进
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 如何跟进
## 怎样跟着教程练习


If you want to follow along, you will require a computer with:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

首先,你需要在你的电脑上准备以下环境:


* Java 8 or 11
* Python 3.5, 3.6 or 3.7

Using Python DataStream API requires installing PyFlink, which is available on [PyPI](https://pypi.org/project/apache-flink/) and can be easily installed using `pip`.
使用 Python DataStream API 需要安装 PyFlink,安装地址 [PyPI](https://pypi.org/project/apache-flink/) ,同时也可以使用 `pip` 快速安装。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
使用 Python DataStream API 需要安装 PyFlink,安装地址 [PyPI](https://pypi.org/project/apache-flink/) ,同时也可以使用 `pip` 快速安装。
使用 Python DataStream API 需要安装 PyFlink,PyFlink 发布在 [PyPI](https://pypi.org/project/apache-flink/) 上,可以通过 `pip` 快速安装。


{% highlight bash %}
$ python -m pip install apache-flink
{% endhighlight %}

Once PyFlink is installed, you can move on to write a Python DataStream job.
一旦 PyFlink 安装完成之后,你可以开始编写 Python DataStream 作业。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
一旦 PyFlink 安装完成之后,你可以开始编写 Python DataStream 作业
一旦 PyFlink 安装完成之后,你就可以开始编写 Python DataStream 作业了


DataStream API applications begin by declaring an execution environment (`StreamExecutionEnvironment`), the context in which a streaming program is executed. This is what you will use to set the properties of your job (e.g. default parallelism, restart strategy), create your sources and finally trigger the execution of the job.
DataStream API 应用程序首先声明一个执行环境(`StreamExecutionEnvironment`),是流式程序执行的上下文。你将使用它来设置作业的属性(例如默认并行性、重启策略)、创建源,并最终触发作业的执行。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DataStream API 应用程序首先声明一个执行环境`StreamExecutionEnvironment`),是流式程序执行的上下文。你将使用它来设置作业的属性(例如默认并行性、重启策略)、创建源并最终触发作业的执行。
DataStream API 应用程序首先需要声明一个执行环境`StreamExecutionEnvironment`),这是流式程序执行的上下文。你将通过它来设置作业的属性(例如默认并发度、重启策略等)、创建源并最终触发作业的执行。


{% highlight python %}
ds.add_sink(StreamingFileSink
.for_row_format('/tmp/output', SimpleStringEncoder())
.build())
{% endhighlight %}

The last step is to execute the actual PyFlink DataStream API job. PyFlink applications are built lazily and shipped to the cluster for execution only once fully formed. To execute an application, you simply call `env.execute(job_name)`.
最后一步是执行真实的 PyFlink DataStream API 作业。PyFlink applications 是惰性构建的,并且只有完全构建之后才会提交给集群执行。要执行一个应用程序,你只需简单的调用 `env.execute(job_name)`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
最后一步是执行真实的 PyFlink DataStream API 作业。PyFlink applications 是惰性构建的,并且只有完全构建之后才会提交给集群执行。要执行一个应用程序,你只需简单的调用 `env.execute(job_name)`
最后一步是执行真实的 PyFlink DataStream API 作业。PyFlink applications 是懒加载的,并且只有在完全构建之后才会提交给集群上执行。要执行一个应用程序,你只需简单地调用 `env.execute(job_name)`


{% highlight bash %}
$ find /tmp/output -type f -exec cat {} \;
1,aaa
2,bbb
{% endhighlight %}

This walkthrough gives you the foundations to get started writing your own PyFlink DataStream API programs. To learn more about the Python DataStream API, please refer to [Flink Python API Docs]({{ site.pythondocs_baseurl }}/api/python) for more details.
本教程为你开始编写自己的 PyFlink DataStream API 程序提供了基础。为了了解更多关于 Python DataStream API 的使用,请查阅 [Flink Python API Docs]({{ site.pythondocs_baseurl }}/api/python)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
本教程为你开始编写自己的 PyFlink DataStream API 程序提供了基础。为了了解更多关于 Python DataStream API 的使用,请查阅 [Flink Python API Docs]({{ site.pythondocs_baseurl }}/api/python)。
本教程为你开始编写自己的 PyFlink DataStream API 程序提供了基础。如果需要了解更多关于 Python DataStream API 的使用,请查阅 [Flink Python API Docs]({{ site.pythondocs_baseurl }}/api/python)。

@wangxlong
Copy link
Contributor Author

@dianfu Thank you for reminder and patient review. Updated~

Copy link
Contributor

@dianfu dianfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dianfu dianfu merged commit cacfd98 into apache:master Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants