(undone) MIT6.824 Lab1

参考:http://nil.csail.mit.edu/6.824/2021/labs/lab-mr.html


task1: 熟悉讲义,尤其是搞明白如何运行测试程序(完成) ------------------------------------------------ start

先看 Introduction
我们的目标:构建一个MapReduce系统。
细节:实现一个工作进程,调用应用程序的Map和Reduce函数,并处理文件的读写;同时还将实现一个协调进程,负责分配任务给工作进程并应对失败的工作进程。构建的内容类似于MapReduce论文中描述的内容。(注意:实验中使用“协调者”而不是论文中的“主节点”。)
在这里插入图片描述

细节在后边
在这里插入图片描述
先根据讲义下载 LAB 代码

git clone git://g.csail.mit.edu/6.824-golabs-2021 6.824

看讲义:代码中已经有了 word-count 和 text indexer 两个应用。同时还有一个极简单的 MapReduce 实现(在一个进程中,一次只运行一个 map 和 一个reduce)。
我们电脑上没 go ,先安装,安装步骤如下 (WSL2 ubuntu20.04)

wget -qO- https://golang.org/dl/go1.15.8.linux-amd64.tar.gz | sudo tar xz -C /usr/local
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go

安装完毕,我们试着按照讲义运行 word count 这个应用

cd ~/6.824
cd src/main
go build -race -buildmode=plugin ../mrapps/wc.go
go run -race mrsequential.go wc.so pg*.txt
more mr-out-0

出现了单词统计结果:
在这里插入图片描述
看来顺利运行了

看看后边的内容
这一段概述了要做的事情(作业目标)
在这里插入图片描述

下面内容介绍了一些代码大致位置:
1.main函数,包括对 协调者 和 工作者 的调动,在 main/mrcoordinator.go 里(不应修改)
2.我们的实现应该放在 mr/coordinator.go, mr/worker.go 和 mr/rpc.go 里
更多内容看后边
在这里插入图片描述
仔细阅读了后边的内容,总结了运行测试程序的方式:
1.修改 mr/coordinator.go Done 函数中的 返回值,把 return false 改成 return true
2.在 main 文件夹下,运行 bash test-mr.sh
看到输出如下:

*** Starting wc test.
2024/09/29 10:39:19 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
cmp: EOF on mr-wc-all which is empty
--- wc output is not the same as mr-correct-wc.txt
--- wc test: FAIL
*** Starting indexer test.
2024/09/29 10:39:21 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
cmp: EOF on mr-indexer-all which is empty
--- indexer output is not the same as mr-correct-indexer.txt
--- indexer test: FAIL
*** Starting map parallelism test.
2024/09/29 10:39:22 rpc.Register: method "Done" has 1 input parameters; needs exactly three
cat: 'mr-out*': No such file or directory
--- saw 0 workers rather than 2
--- map parallelism test: FAIL
cat: 'mr-out*': No such file or directory
--- map workers did not run in parallel
--- map parallelism test: FAIL
*** Starting job count test.
2024/09/29 10:39:24 rpc.Register: method "Done" has 1 input parameters; needs exactly three
cat: 'mr-out*': No such file or directory
test-mr.sh: line 170: [: : integer expression expected
--- job count test: PASS
*** Starting early exit test.
2024/09/29 10:39:25 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
sort: cannot read: 'mr-out*': No such file or directory
--- early exit test: PASS
*** Starting crash test.
2024/09/29 10:39:26 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
cmp: EOF on mr-crash-all which is empty
--- crash output is not the same as mr-correct-crash.txt
--- crash test: FAIL
*** FAILED SOME TESTS

本 task 完成

task1: 熟悉讲义,尤其是搞明白如何运行测试程序(完成) ------------------------------------------------ end

task2: 该明白测试程序的原理,尤其是如何测试代码是并行运行的 ------------------------------------------------ start

TODO:here

task2: 该明白测试程序的原理,尤其是如何测试代码是并行运行的 ------------------------------------------------ end

TODO: 看看 word count 和 MapReduce 的联动

TODO: here

数据治理是确保数据准确性、可靠性、安全性、可用性和完整性的体系和框架。它定义了组织内部如何使用、存储、保护和共享数据的规则和流程。数据治理的重要性随着数字化转型的加速而日益凸显,它能够提高决策效率、增强业务竞争力、降低风险,并促进业务创新。有效的数据治理体系可以确保数据在采集、存储、处理、共享和保护等环节的合规性和有效性。 数据质量管理是数据治理中的关键环节,它涉及数据质量评估、数据清洗、标准化和监控。高质量的数据能够提升业务决策的准确性,优化业务流程,并挖掘潜在的商业价值。随着大数据和人工智能技术的发展,数据质量管理在确保数据准确性和可靠性方面的作用愈发重要。企业需要建立完善的数据质量管理和校验机制,并通过数据清洗和标准化提高数据质量。 数据安全与隐私保护是数据治理中的另一个重要领域。随着数据量的快速增长和互联网技术的迅速发展,数据安全与隐私保护面临前所未有的挑战。企业需要加强数据安全与隐私保护的法律法规和技术手段,采用数据加密、脱敏和备份恢复等技术手段,以及加强培训和教育,提高安全意识和技能水平。 数据流程管理与监控是确保数据质量、提高数据利用率、保护数据安全的重要环节。有效的数据流程管理可以确保数据流程的合规性和高效性,而实时监控则有助于及时发现并解决潜在问题。企业需要设计合理的数据流程架构,制定详细的数据管理流程规范,并运用数据审计和可视化技术手段进行监控。 数据资产管理是将数据视为组织的重要资产,通过有效的管理和利用,为组织带来经济价值。数据资产管理涵盖数据的整个生命周期,包括数据的创建、存储、处理、共享、使用和保护。它面临的挑战包括数据量的快速增长、数据类型的多样化和数据更新的迅速性。组织需要建立完善的数据管理体系,提高数据处理和分析能力,以应对这些挑战。同时,数据资产的分类与评估、共享与使用规范也是数据资产管理的重要组成部分,需要制定合理的标准和规范,确保数据共享的安全性和隐私保护,以及建立合理的利益分配和权益保障机制。
要添加一个统计展示组件 Footer.vue,可以按照以下步骤进行操作: 1. 在 src/components 目录下创建一个名为 Footer.vue 的文件,编写统计展示组件的模板和样式,例如: ```html <template> <div class="footer"> <span>已完成 {{ doneCount }} 项</span> <span>未完成 {{ undoneCount }} 项</span> </div> </template> <style> .footer { display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: #f0f0f0; } </style> ``` 2. 在 App.vue 中导入 Footer 组件,并在模板中使用它,例如: ```html <template> <div> <h1>Todo List</h1> <input v-model="inputValue" @keyup.enter="handleAddItem"/> <ul> <li v-for="(item, index) in todoList" :key="index"> <span :class="{ 'done': item.done }" @click="handleToggleDone(index)">{{ item.content }}</span> <button @click="handleDeleteItem(index)">删除</button> </li> </ul> <footer-component :done-count="doneCount" :undone-count="undoneCount"></footer-component> </div> </template> <script> import Footer from './components/Footer.vue' export default { components: { 'footer-component': Footer }, data() { return { todoList: [ { content: '学习 Vue.js', done: true }, { content: '学习 React', done: false }, { content: '学习 Angular', done: false } ], inputValue: '' } }, computed: { doneCount() { return this.todoList.filter(item => item.done).length }, undoneCount() { return this.todoList.filter(item => !item.done).length } }, methods: { handleAddItem() { if (this.inputValue.trim() === '') return this.todoList.push({ content: this.inputValue, done: false }) this.inputValue = '' }, handleToggleDone(index) { this.todoList[index].done = !this.todoList[index].done }, handleDeleteItem(index) { this.todoList.splice(index, 1) } } } </script> ``` 3. 在 Footer.vue 中定义 props 接收父组件传递的数据,例如: ```js export default { props: { doneCount: { type: Number, required: true }, undoneCount: { type: Number, required: true } } } ``` 4. 在 Footer.vue 中使用 props 中接收的数据,例如: ```html <template> <div class="footer"> <span>已完成 {{ doneCount }} 项</span> <span>未完成 {{ undoneCount }} 项</span> </div> </template> ``` 这样就完成了添加统计展示组件 Footer.vue 的操作。在 App.vue 中使用 footer-component 标签即可展示 Footer.vue 组件的内容。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值