| <?xml version="1.0" encoding="UTF-8"?> |
| <project version="4"> |
| <component name="StudySettings"> |
| <StudyTaskManager> |
| <option name="VERSION" value="14" /> |
| <option name="myUserTests"> |
| <map /> |
| </option> |
| <option name="course"> |
| <EduCourse> |
| <option name="authors"> |
| <list> |
| <StepikUserInfo> |
| <option name="firstName" value="Henry" /> |
| <option name="id" value="48485817" /> |
| <option name="lastName" value="Suryawirawan" /> |
| </StepikUserInfo> |
| </list> |
| </option> |
| <option name="compatible" value="true" /> |
| <option name="courseMode" value="Course Creator" /> |
| <option name="createDate" value="1557824500323" /> |
| <option name="customPresentableName" /> |
| <option name="description" value="This course provides a series of kata to get familiar with Apache Beam. Apache Beam website – https://beam.apache.org/" /> |
| <option name="environment" value="" /> |
| <option name="fromZip" value="false" /> |
| <option name="id" value="54532" /> |
| <option name="index" value="-1" /> |
| <option name="instructors"> |
| <list> |
| <option value="48485817" /> |
| </list> |
| </option> |
| <option name="language" value="Python 2.7" /> |
| <option name="languageCode" value="en" /> |
| <option name="name" value="Beam Kata - Python" /> |
| <option name="public" value="false" /> |
| <option name="sectionIds"> |
| <list /> |
| </option> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="type" value="pycharm11 Python 2.7" /> |
| <option name="updateDate" value="1557824500000" /> |
| <option name="items"> |
| <list> |
| <Section> |
| <option name="courseId" value="54532" /> |
| <option name="customPresentableName" /> |
| <option name="id" value="85644" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Introduction" /> |
| <option name="position" value="0" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824504000" /> |
| <option name="items"> |
| <list> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229517" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Hello Beam" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="updateDate" value="1557824508000" /> |
| <option name="unitId" value="202042" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Hello Beam Pipeline</h2> <p>This kata is to create a simple pipeline that takes a hardcoded input element "Hello Beam"</p> <br> <br> <div class='hint'>Hardcoded input can be created using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Create">Create</a></div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713750" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Hello Beam" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="903" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.Create(['Hello Beam'])" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824510000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| </list> |
| </option> |
| </Section> |
| <Section> |
| <option name="courseId" value="54532" /> |
| <option name="customPresentableName" /> |
| <option name="id" value="85645" /> |
| <option name="index" value="2" /> |
| <option name="name" value="Core Transforms" /> |
| <option name="position" value="0" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824511000" /> |
| <option name="items"> |
| <list> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229518" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Map" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824515000" /> |
| <option name="unitId" value="202043" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>ParDo</h2> <p>ParDo is a Beam transform for generic parallel processing. The ParDo processing paradigm is similar to the “Map” phase of a Map/Shuffle/Reduce-style algorithm: a ParDo transform considers each element in the input PCollection, performs some processing function (your user code) on that element, and emits zero, one, or multiple elements to an output PCollection.</p> <p>For this task, please write a simple ParDo that maps the input element by multiplying it by 10.</p> <br> <br> <div class='hint'>Override <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.DoFn.process">process</a> method</div> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.ParDo">ParDo</a> with <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.DoFn">DoFn</a></div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713751" /> |
| <option name="index" value="1" /> |
| <option name="name" value="ParDo" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="919" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="def process(self, element): yield element * 10" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="1" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1036" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.ParDo(MultiplyByTenDoFn())" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824517000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>ParDo OneToMany</h2> <p>For this task, please write a ParDo that maps each input sentence into words tokenized by whitespace (" ").</p> <br> <br> <div class='hint'>Override <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.DoFn.process">process</a> method. You can return an Iterable for multiple elements or call "yield" for each element to return a generator.</div> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.ParDo">ParDo</a> with <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.DoFn">DoFn</a></div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713752" /> |
| <option name="index" value="2" /> |
| <option name="name" value="ParDo OneToMany" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="920" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="def process(self, element): return element.split()" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="1" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1057" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.ParDo(BreakIntoWordsDoFn())" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824519000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>MapElements</h2> <p>The Beam SDKs provide language-specific ways to simplify how you provide your DoFn implementation.</p> <p>In this task, we are going to implement a simple map function that multiplies all input elements by 5 using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Map"> Map</a>. </p> <br> <br> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Map">Map</a> with a lambda.</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713753" /> |
| <option name="index" value="3" /> |
| <option name="name" value="Map" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="942" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.Map(lambda num: num * 5)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824521000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>FlatMapElements</h2> <p>The Beam SDKs provide language-specific ways to simplify how you provide your DoFn implementation.</p> <p>FlatMap can be used to simplify DoFn that maps an element to multiple elements (one to many).</p> <p>In this task, we are going to implement a function that maps each input sentence into words tokenized by whitespace (" ") using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.FlatMap"> FlatMap</a>. </p> <br> <br> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.FlatMap">FlatMap</a> with a lambda.</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713754" /> |
| <option name="index" value="4" /> |
| <option name="name" value="FlatMap" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="968" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.FlatMap(lambda sentence: sentence.split())" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824523000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229519" /> |
| <option name="index" value="2" /> |
| <option name="name" value="GroupByKey" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="updateDate" value="1557824527000" /> |
| <option name="unitId" value="202044" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>GroupByKey</h2> <p>GroupByKey is a Beam transform for processing collections of key/value pairs. It’s a parallel reduction operation, analogous to the Shuffle phase of a Map/Shuffle/Reduce-style algorithm. The input to GroupByKey is a collection of key/value pairs that represents a multimap, where the collection contains multiple pairs that have the same key, but different values. Given such a collection, you use GroupByKey to collect all of the values associated with each unique key.</p> <p>In this task, we are going to implement a <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.GroupByKey"> GroupByKey</a> transform that groups words by its first letter. </p> <br> <br> <div class='hint'>Refer to <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.GroupByKey">GroupByKey</a> to solve this problem</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713756" /> |
| <option name="index" value="1" /> |
| <option name="name" value="GroupByKey" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="8" /> |
| <option name="offset" value="970" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="| TODO()" /> |
| <option name="possibleAnswer" value="| beam.Map(lambda word: (word[0], word)) | beam.GroupByKey()" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824529000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229520" /> |
| <option name="index" value="3" /> |
| <option name="name" value="CoGroupByKey" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="updateDate" value="1557824533000" /> |
| <option name="unitId" value="202045" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>CoGroupByKey</h2> <p>CoGroupByKey performs a relational join of two or more key/value PCollections that have the same key type.</p> <p>In this task, we are going to implement a <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.util.html#apache_beam.transforms.util.CoGroupByKey"> CoGroupByKey</a> transform that join words by its first alphabetical letter, and then produces the string representation of the WordsAlphabet model. </p> <br> <br> <div class='hint'>Refer to <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.util.html#apache_beam.transforms.util.CoGroupByKey">CoGroupByKey</a> to solve this problem</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713757" /> |
| <option name="index" value="1" /> |
| <option name="name" value="CoGroupByKey" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1228" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="def map_to_alphabet_kv(word): return (word[0], word) def cogbk_result_to_wordsalphabet(cgbk_result): (alphabet, words) = cgbk_result return WordsAlphabet(alphabet, words['fruits'][0], words['countries'][0]) fruits_kv = (fruits | 'Fruit to KV' >> beam.Map(map_to_alphabet_kv)) countries_kv = (countries | 'Country to KV' >> beam.Map(map_to_alphabet_kv)) return ({'fruits': fruits_kv, 'countries': countries_kv} | beam.CoGroupByKey() | beam.Map(cogbk_result_to_wordsalphabet))" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824535000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229521" /> |
| <option name="index" value="4" /> |
| <option name="name" value="Combine" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824539000" /> |
| <option name="unitId" value="202046" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Combine - Simple Function</h2> <p>Combine is a Beam transform for combining collections of elements or values in your data. When you apply a Combine transform, you must provide the function that contains the logic for combining the elements or values. The combining function should be commutative and associative, as the function is not necessarily invoked exactly once on all values with a given key. Because the input data (including the value collection) may be distributed across multiple workers, the combining function might be called multiple times to perform partial combining on subsets of the value collection.</p> <p>Simple combine operations, such as sums, can usually be implemented as a simple function.</p> <p>In this task, we are going to implement the summation of numbers using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.CombineGlobally"> CombineGlobally</a>. </p> <br> <br> <div class="hint"> Implement a simple Python function that performs the summation of the values. </div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713758" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Simple Function" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="900" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="total = 0 for num in numbers: total += num return total" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="1" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1036" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.CombineGlobally(sum)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824541000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Combine - CombineFn</h2> <p>Combine is a Beam transform for combining collections of elements or values in your data. When you apply a Combine transform, you must provide the function that contains the logic for combining the elements or values. The combining function should be commutative and associative, as the function is not necessarily invoked exactly once on all values with a given key. Because the input data (including the value collection) may be distributed across multiple workers, the combining function might be called multiple times to perform partial combining on subsets of the value collection.</p> <p>Complex combination operations might require you to create a subclass of CombineFn that has an accumulation type distinct from the input/output type. You should use CombineFn if the combine function requires a more sophisticated accumulator, must perform additional pre- or post-processing, might change the output type, or takes the key into account.</p> <p>In this task, we are going to implement the average of numbers using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.CombineFn"> Combine.CombineFn</a>. </p> <br> <br> <div class="hint"> Extend the <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.CombineFn">CombineFn</a> class that counts the average of the number. </div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713759" /> |
| <option name="index" value="2" /> |
| <option name="name" value="CombineFn" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="916" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="def create_accumulator(self): return 0.0, 0 def add_input(self, accumulator, element): (sum, count) = accumulator return sum + element, count + 1 def merge_accumulators(self, accumulators): sums, counts = zip(*accumulators) return sum(sums), sum(counts) def extract_output(self, accumulator): (sum, count) = accumulator return sum / count if count else float('NaN')" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="1" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1420" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.CombineGlobally(AverageFn())" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824543000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Combine - Combine PerKey</h2> <p>After creating a keyed PCollection (for example, by using a GroupByKey transform), a common pattern is to combine the collection of values associated with each key into a single, merged value. This pattern of a GroupByKey followed by merging the collection of values is equivalent to Combine PerKey transform. The combine function you supply to Combine PerKey must be an associative reduction function or a subclass of CombineFn.</p> <p>In this task, we are going to implement the sum of scores per player using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.CombinePerKey"> CombinePerKey</a>. </p> <br> <br> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.CombinePerKey">CombinePerKey(CombineFn)</a>.</div> <div class='hint'>Extend the <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.CombineFn">CombineFn</a> class that counts the sum of the number.</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713760" /> |
| <option name="index" value="3" /> |
| <option name="name" value="Combine PerKey" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1088" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.CombinePerKey(sum)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824546000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229522" /> |
| <option name="index" value="5" /> |
| <option name="name" value="Flatten" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824550000" /> |
| <option name="unitId" value="202047" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Flatten</h2> <p>Flatten is a Beam transform for PCollection objects that store the same data type. Flatten merges multiple PCollection objects into a single logical PCollection.</p> <p>In this task, we are going to implement a <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Flatten"> Flatten</a> transform that merges two PCollection of words into a single PCollection. </p> <br> <br> <div class="hint"> Refer to <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Flatten">Flatten</a> to solve this problem. </div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713761" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Flatten" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1140" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.Flatten()" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824553000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229523" /> |
| <option name="index" value="6" /> |
| <option name="name" value="Partition" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824556000" /> |
| <option name="unitId" value="202048" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Partition</h2> <p>Partition is a Beam transform for PCollection objects that store the same data type. Partition splits a single PCollection into a fixed number of smaller collections.</p> <p>Partition divides the elements of a PCollection according to a partitioning function that you provide. The partitioning function contains the logic that determines how to split up the elements of the input PCollection into each resulting partition PCollection.</p> <p>In this task, we are going to implement a <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Partition"> Partition</a> transform that splits a PCollection of numbers into two PCollections. The first PCollection contains numbers greater than 100, and the second PCollection contains the remaining numbers. </p> <br> <br> <div class="hint"> Refer to <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Partition">Partition</a> to solve this problem. </div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713762" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Partition" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="924" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="if number > 100: return 0 else: return 1" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="1" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1087" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.Partition(partition_fn, 2)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824558000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| </list> |
| </option> |
| </Section> |
| <Section> |
| <option name="courseId" value="54532" /> |
| <option name="customPresentableName" /> |
| <option name="id" value="85646" /> |
| <option name="index" value="3" /> |
| <option name="name" value="Common Transforms" /> |
| <option name="position" value="0" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="updateDate" value="1557824560000" /> |
| <option name="items"> |
| <list> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229524" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Filter" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824563000" /> |
| <option name="unitId" value="202049" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Filter using ParDo</h2> <p>In this task, we are going to implement a filter function that filters out the even numbers by using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.ParDo"> ParDo</a>. </p> <br> <br> <div class='hint'>Override <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.DoFn.process">process</a> method. You can use "yield" for each intended element.</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713763" /> |
| <option name="index" value="1" /> |
| <option name="name" value="ParDo" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="942" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="def process(self, element): if element % 2 == 1: yield element" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824566000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Filter</h2> <p>The Beam SDKs provide language-specific ways to simplify how you provide your DoFn implementation.</p> <p>In this task, we are going to implement a filter function that filters out the odd numbers by using <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Filter"> Filter</a>. </p> <br> <br> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.Filter">Filter</a> with a lambda.</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713764" /> |
| <option name="index" value="2" /> |
| <option name="name" value="Filter" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="934" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.Filter(lambda num: num % 2 == 0)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824567000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229525" /> |
| <option name="index" value="2" /> |
| <option name="name" value="Aggregation" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824571000" /> |
| <option name="unitId" value="202050" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Aggregation - Count</h2> <p> In this task, we are going to count the number of elements from an input.</p> <br> <br> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.combiners.html#apache_beam.transforms.combiners.Count">Count</a></div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713765" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Count" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="934" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.combiners.Count.Globally()" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824574000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Aggregation - Sum</h2> <p> In this task, we are going to compute the sum of all elements from an input.</p> <br> <br> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.core.html#apache_beam.transforms.core.CombineGlobally">CombineGlobally</a> and Python built-in <a href="https://docs.python.org/2/library/functions.html#sum">sum</a></div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713766" /> |
| <option name="index" value="2" /> |
| <option name="name" value="Sum" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="934" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.CombineGlobally(sum)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824575000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Aggregation - Mean</h2> <p>In this task, we are going to compute the mean/average of all elements from an input.</p> <br> <br> <div class='hint'>Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.combiners.html#apache_beam.transforms.combiners.Mean">Mean</a></div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713767" /> |
| <option name="index" value="3" /> |
| <option name="name" value="Mean" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="934" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.combiners.Mean.Globally()" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824578000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Aggregation - Smallest</h2> <p>In this task, we are going to compute the smallest of the elements from an input.</p> <br> <br> <div class="hint"> Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.combiners.html#apache_beam.transforms.combiners.Top.Smallest">Top.Smallest</a> </div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713768" /> |
| <option name="index" value="4" /> |
| <option name="name" value="Smallest" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="934" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.combiners.Top.Smallest(1)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824580000" /> |
| </EduTask> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Aggregation - Largest</h2> <p>In this task, we are going to compute the largest of the elements from an input.</p> <br> <br> <div class="hint"> Use <a href="https://beam.apache.org/releases/pydoc/2.11.0/apache_beam.transforms.combiners.html#apache_beam.transforms.combiners.Top.Largest">Top.Largest</a> </div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713769" /> |
| <option name="index" value="5" /> |
| <option name="name" value="Largest" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="934" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.combiners.Top.Largest(1)" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824582000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| </list> |
| </option> |
| </Section> |
| <Section> |
| <option name="courseId" value="54532" /> |
| <option name="customPresentableName" /> |
| <option name="id" value="85647" /> |
| <option name="index" value="4" /> |
| <option name="name" value="Examples" /> |
| <option name="position" value="0" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824583000" /> |
| <option name="items"> |
| <list> |
| <Lesson> |
| <option name="customPresentableName" /> |
| <option name="id" value="229526" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Word Count" /> |
| <option name="stepikChangeStatus" value="Content changed" /> |
| <option name="updateDate" value="1557824587000" /> |
| <option name="unitId" value="202051" /> |
| <option name="items"> |
| <list> |
| <EduTask> |
| <option name="customPresentableName" /> |
| <option name="descriptionFormat" value="HTML" /> |
| <option name="descriptionText" value="<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <html> <h2>Word Count Pipeline</h2> <p>This kata is to create a pipeline that counts the number of words.</p> <p>For this task, please output the count of each word in the following format:<br/> <pre> word:count ball:5 book:3 </pre> </p> <br> <br> <div class='hint'>Refer to your lessons above.</div> </html> " /> |
| <option name="feedbackLink"> |
| <FeedbackLink> |
| <option name="link" /> |
| <option name="type" value="STEPIK" /> |
| </FeedbackLink> |
| </option> |
| <option name="id" value="713770" /> |
| <option name="index" value="1" /> |
| <option name="name" value="Word Count" /> |
| <option name="record" value="-1" /> |
| <option name="status" value="Unchecked" /> |
| <option name="stepikChangeStatus" value="Up to date" /> |
| <option name="files"> |
| <map> |
| <entry key="task.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list> |
| <AnswerPlaceholder> |
| <option name="hints"> |
| <list /> |
| </option> |
| <option name="index" value="0" /> |
| <option name="initialState" /> |
| <option name="initializedFromDependency" value="false" /> |
| <option name="length" value="6" /> |
| <option name="offset" value="1021" /> |
| <option name="placeholderDependency" /> |
| <option name="placeholderText" value="TODO()" /> |
| <option name="possibleAnswer" value="beam.FlatMap(lambda sentence: sentence.split()) | beam.combiners.Count.PerElement() | beam.Map(lambda (k, v): k + ":" + str(v))" /> |
| <option name="selected" value="false" /> |
| <option name="status" value="Unchecked" /> |
| <option name="studentAnswer" /> |
| <option name="useLength" value="false" /> |
| </AnswerPlaceholder> |
| </list> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="task.py" /> |
| <option name="text" value="# TODO: type solution here " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="true" /> |
| </TaskFile> |
| </value> |
| </entry> |
| <entry key="tests.py"> |
| <value> |
| <TaskFile> |
| <option name="answerPlaceholders"> |
| <list /> |
| </option> |
| <option name="highlightErrors" value="true" /> |
| <option name="name" value="tests.py" /> |
| <option name="text" value="from test_helper import run_common_tests, failed, passed, get_answer_placeholders def test_answer_placeholders(): placeholders = get_answer_placeholders() placeholder = placeholders[0] if placeholder == "": # TODO: your condition here passed() else: failed() if __name__ == '__main__': run_common_tests() # test_answer_placeholders() # TODO: uncomment test call " /> |
| <option name="trackChanges" value="true" /> |
| <option name="trackLengths" value="true" /> |
| <option name="visible" value="false" /> |
| </TaskFile> |
| </value> |
| </entry> |
| </map> |
| </option> |
| <option name="updateDate" value="1557824590000" /> |
| </EduTask> |
| </list> |
| </option> |
| </Lesson> |
| </list> |
| </option> |
| </Section> |
| </list> |
| </option> |
| </EduCourse> |
| </option> |
| </StudyTaskManager> |
| </component> |
| </project> |