Jug 1.6.2 发布,基于任务的并行处理框架

栏目: 软件资讯 · 发布时间: 6年前

内容简介:Jug 1.6.2 已发布,更新如下: 将 return_value 参数添加到 jug_execute 新增 exit_env_vars 更新日志列表 Jug 是一个基于任务的并行处理框架,采用 Python 编写,可用来在不同的机器上运行同一个任务,使用 NFS ...

Jug 1.6.2 已发布,更新如下:

  • 将 return_value 参数添加到 jug_execute

  • 新增 exit_env_vars

更新日志列表

Jug 是一个基于任务的并行处理框架,采用 Python 编写,可用来在不同的机器上运行同一个任务,使用 NFS 作为文件系统的通讯。

示例:

from time import sleep

from jug import TaskGenerator

@TaskGenerator
def is_prime(n):
    sleep(1.)
    for j in range(2, n - 1):
        if (n % j) == 0:
            return False
    return True

@TaskGenerator
def count_primes(ps):
    return sum(ps)

@TaskGenerator
def write_output(n):
    output = open('output.txt', 'wt')
    output.write("Found {0} primes <= 100.\n".format(n))
    output.close()

primes100 = []
for n in range(2, 101):
    primes100.append(is_prime(n))

n_primes = count_primes(primes100)
write_output(n_primes)

下载地址:


【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Foundations of PEAR

Foundations of PEAR

Good, Nathan A./ Kent, Allan / Springer-Verlag New York Inc / 2006-11 / $ 50.84

PEAR, the PHP Extension and Application Repository, is a bountiful resource for any PHP developer. Within its confines lie the tools that you need to do your job more quickly and efficiently. You need......一起来看看 《Foundations of PEAR》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具