本文整理汇总了Python中radical.ensemblemd.SingleClusterEnvironment.deallocate方法的典型用法代码示例。如果您正苦于以下问题:Python SingleClusterEnvironment.deallocate方法的具体用法?Python SingleClusterEnvironment.deallocate怎么用?Python SingleClusterEnvironment.deallocate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类radical.ensemblemd.SingleClusterEnvironment
的用法示例。
在下文中一共展示了SingleClusterEnvironment.deallocate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pipeline_remote
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def test_pipeline_remote(self,cmdopt):
#if __name__ == "__main__":
resource = cmdopt
home = expanduser("~")
try:
with open('%s/workspace/EnsembleMDTesting/config.json'%home) as data_file:
config = json.load(data_file)
#resource='xsede.stampede'
print "project: ",config[resource]['project']
print "username: ", config[resource]['username']
# Create a new static execution context with one resource and a fixed
# number of cores and runtime.
cluster = SingleClusterEnvironment(
resource=resource,
cores=1,
walltime=15,
#username='tg831932',
username=config[resource]['username'],
#project="TG-MCB090174",
#access_schema="ssh",
#queue="development",
project=config[resource]['project'],
access_schema = config[resource]['schema'],
queue = config[resource]['queue'],
database_url='mongodb://suvigya:[email protected]:51585',
database_name='rutgers_thesis',
)
os.system('/bin/echo remote > input_file.txt')
# Allocate the resources.
cluster.allocate()
# Set the 'instances' of the pipeline to 1. This means that 1 instance
# of each pipeline step is executed.
app = _TestPipeline(steps=1,instances=1)
cluster.run(app)
# Deallocate the resources.
cluster.deallocate()
f = open("%s/workspace/EnsembleMDTesting/temp_results/remote_file.txt"%home)
print "Name of file: ", f.name
print "file closed or not: ", f.closed
fname = f.readline().split()
print "fname: ", fname
assert fname == ['remote']
f.close()
os.remove("%s/workspace/EnsembleMDTesting/temp_results/remote_file.txt"%home)
except EnsemblemdError, er:
print "Ensemble MD Toolkit Error: {0}".format(str(er))
raise # Just raise the execption again to get the backtrace
示例2: test_copy_input_data_single
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def test_copy_input_data_single(self):
#if __name__ == '__main__':
#resource = 'local.localhost'
try:
with open('%s/config.json'%os.path.dirname(os.path.abspath(__file__))) as data_file:
config = json.load(data_file)
# Create a new static execution context with one resource and a fixed
# number of cores and runtime.
cluster = SingleClusterEnvironment(
resource='xsede.stampede',
cores=1,
walltime=15,
#username=None,
username='tg831932',
project='TG-MCB090174',
access_schema='ssh',
queue='development',
#project=config[resource]['project'],
#access_schema = config[resource]['schema'],
#queue = config[resource]['queue'],
database_url='mongodb://suvigya:[email protected]:51585/rutgers_thesis'
)
os.system('/bin/echo passwd > input_file.txt')
# Allocate the resources.
cluster.allocate(wait=True)
# Set the 'instances' of the pipeline to 1. This means that 1 instance
# of each pipeline step is executed.
## app = _TestMyApp(instances=1,
## copy_directives="/etc/passwd",
## checksum_inputfile="passwd",
## download_output="CHKSUM_1"
## )
app = _TestMyApp(steps=1,instances=1)
cluster.run(app)
f = open("./output_file.txt")
print "Name of file: ", f.name
print "file closed or not: ", f.closed
fname = f.readline().split()
print "fname: ", fname
cluster.deallocate()
assert fname == ['passwd']
f.close()
os.remove("./output_file.txt")
except Exception as er:
print "Ensemble MD Toolkit Error: {0}".format(str(er))
raise # Just raise the execption again to get the backtrace
示例3: test_sal
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def test_sal(self,cmdopt):
#if __name__ == "__main__":
resource = cmdopt
home = expanduser("~")
try:
with open('%s/workspace/EnsembleMDTesting/config.json'%home) as data_file:
config = json.load(data_file)
print 'Project: ',config[resource]['project']
print 'Username: ',config[resource]['username']
# Create a new static execution context with one resource and a fixed
# number of cores and runtime.
cluster = SingleClusterEnvironment(
resource=resource,
cores=1,
walltime=15,
username=config[resource]['username'],
project=config[resource]['project'],
access_schema = config[resource]['schema'],
queue = config[resource]['queue'],
database_url='mongodb://suvigya:[email protected]:51585/rutgers_thesis',
#database_name='myexps',
)
# Allocate the resources.
cluster.allocate()
randomsa = RandomSA(maxiterations=1, simulation_instances=1, analysis_instances=1)
cluster.run(randomsa)
cluster.deallocate()
# After execution has finished, we print some statistical information
# extracted from the analysis results that were transferred back.
for it in range(1, randomsa.iterations+1):
print "\nIteration {0}".format(it)
ldists = []
for an in range(1, randomsa.analysis_instances+1):
ldists.append(int(open("analysis-{0}-{1}.dat".format(it, an), "r").readline()))
print " * Levenshtein Distances: {0}".format(ldists)
print " * Mean Levenshtein Distance: {0}".format(sum(ldists) / len(ldists))
assert os.path.isfile("%s/workspace/EnsembleMDTesting/E2E_test/analysis-1-1.dat"%home)
os.remove("%s/workspace/EnsembleMDTesting/E2E_test/analysis-1-1.dat"%home)
except EnsemblemdError, er:
print "Ensemble MD Toolkit Error: {0}".format(str(er))
raise # Just raise the execption again to get the backtrace
示例4: enmd_setup_run
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def enmd_setup_run(request):
from radical.ensemblemd import SingleClusterEnvironment
try:
sec = SingleClusterEnvironment(
#resource="local.localhost",
#cores=1,
#walltime=1,
resource="xsede.stampede",
cores=1,
walltime=1,
username='tg831932',
project='TG-MCB090174',
access_schema='ssh',
queue='development',
database_url='mongodb://suvigya:[email protected]:51585',
database_name='rutgers_thesis'
)
test = _TestRun(steps=1,instances=1)
ret_allocate = sec.allocate()
ret_run = sec.run(test)
ret_deallocate = sec.deallocate()
except Exception as e:
#print ret_run
raise
return ret_allocate,ret_run,ret_deallocate
示例5: test_all_pairs_remote
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def test_all_pairs_remote(self,cmdopt):
#if __name__ == "__main__":
# use the resource specified as argument, fall back to localhost
resource = cmdopt
home = expanduser("~")
try:
with open('%s/workspace/EnsembleMDTesting/config.json'%home) as data_file:
config = json.load(data_file)
print 'project: ', config[resource]['project']
print 'username: ',config[resource]['username']
# Create a new static execution context with one resource and a fixed
# number of cores and runtime.
cluster = SingleClusterEnvironment(
resource=resource,
cores=1,
walltime=15,
username=config[resource]['username'],
project=config[resource]['project'],
access_schema = config[resource]['schema'],
queue = config[resource]['queue'],
database_url='mongodb://suvigya:[email protected]:51585',
database_name='rutgers_thesis',
)
# Allocate the resources.
cluster.allocate()
# For example the set has 5 elements.
ElementsSet1 = range(1,2)
randAP = _TestRandomAP(set1elements=ElementsSet1,windowsize1=1)
cluster.run(randAP)
cluster.deallocate()
print "Pattern Execution Completed Successfully! Result files are downloaded!"
assert os.path.isfile("./comparison_1_1.log")
os.remove("./comparison_1_1.log")
except EnsemblemdError, er:
print "Ensemble MD Toolkit Error: {0}".format(str(er))
raise # Just raise the execption again to get the backtrace
示例6: enmd_setup_run
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def enmd_setup_run(request):
from radical.ensemblemd import SingleClusterEnvironment
try:
sec = SingleClusterEnvironment(
resource="local.localhost",
cores=1,
walltime=1,
database_url='mongodb://suvigya:[email protected]:51585',
database_name='rutgers_thesis'
)
test = _TestRun(steps=1,instances=1)
ret_allocate = sec.allocate()
ret_run = sec.run(test)
ret_deallocate = sec.deallocate()
except Exception as e:
print ret_run
raise
return ret_allocate,ret_run,ret_deallocate
示例7: enmd_setup
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def enmd_setup():
from radical.ensemblemd import SingleClusterEnvironment
try:
sec = SingleClusterEnvironment(
resource="local.localhost",
cores=1,
walltime=1,
database_url='mongodb://suvigya:[email protected]:51585',
database_name='rutgers_thesis'
)
ret_allocate = sec.allocate(wait=True)
ret_deallocate = False
ret_deallocate= sec.deallocate()
except Exception as e:
print 'test failed'
raise
return ret_allocate,ret_deallocate
示例8: enmd_setup
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def enmd_setup():
from radical.ensemblemd import SingleClusterEnvironment
try:
sec = SingleClusterEnvironment(
resource="xsede.stampede",
cores=1,
walltime=1,
username='tg831932',
project='TG-MCB090174',
access_schema='ssh',
queue='development',
database_url='mongodb://suvigya:[email protected]:51585',
database_name='rutgers_thesis'
)
ret_allocate = sec.allocate(wait=True)
ret_deallocate = False
ret_deallocate= sec.deallocate()
except Exception as e:
print 'test failed'
raise
return ret_allocate,ret_deallocate
示例9: resources
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
database_url='mongodb://ec2-54-221-194-147.compute-1.amazonaws.com:24242',
database_name='myexps',
)
# Allocate the resources.
cluster.allocate()
# Set the 'instances' of the pipeline to 16. This means that 16 instances
# of each pipeline step are executed.
#
# Execution of the 16 pipeline instances can happen concurrently or
# sequentially, depending on the resources (cores) available in the
# SingleClusterEnvironment.
ccount = CharCount(steps=3,instances=16)
cluster.run(ccount)
# Deallocate the resources.
cluster.deallocate()
# Print the checksums
print "\nResulting checksums:"
import glob
for result in glob.glob("cfreqs-*.sha1"):
print " * {0}".format(open(result, "r").readline().strip())
except EnsemblemdError, er:
print "Ensemble MD Toolkit Error: {0}".format(str(er))
raise # Just raise the execption again to get the backtrace
示例10: test_replica_exchange
# 需要导入模块: from radical.ensemblemd import SingleClusterEnvironment [as 别名]
# 或者: from radical.ensemblemd.SingleClusterEnvironment import deallocate [as 别名]
def test_replica_exchange(self,cmdopt):
#if __name__ == "__main__":
resource = cmdopt
home = expanduser("~")
try:
with open('%s/workspace/EnsembleMDTesting/config.json'%home) as data_file:
config = json.load(data_file)
print 'Project: ',config[resource]['project']
print 'Username: ',config[resource]['username']
# Create a new static execution context with one resource and a fixed
# number of cores and runtime.
workdir_local = os.getcwd()
cluster = SingleClusterEnvironment(
resource=resource,
cores=1,
walltime=15,
username=config[resource]['username'],
project=config[resource]['project'],
access_schema = config[resource]['schema'],
queue = config[resource]['queue'],
database_url='mongodb://suvigya:[email protected]:51585/rutgers_thesis',
#database_name='myexps',
)
# Allocate the resources.
cluster.allocate()
# creating RE pattern object
re_pattern = _TestRePattern(workdir_local)
# set number of replicas
re_pattern.replicas = 2
# set number of cycles
re_pattern.nr_cycles = 1
# initializing replica objects
replicas = re_pattern.initialize_replicas()
re_pattern.add_replicas( replicas )
# run RE simulation
cluster.run(re_pattern, force_plugin="replica_exchange.static_pattern_1")
cluster.deallocate()
print "RE simulation finished!"
print "Simulation performed {0} cycles for {1} replicas. In your working directory you should".format(re_pattern.nr_cycles, re_pattern.replicas)
print "have {0} md_input_x_y.md files and {0} md_input_x_y.out files where x in {{0,1,2,...{1}}} and y in {{0,1,...{2}}}.".format( (re_pattern.nr_cycles*re_pattern.replicas), (re_pattern.replicas-1), (re_pattern.nr_cycles-1) )
print ".md file is replica input file and .out is output file providing number of occurrences of each character."
assert os.path.isfile("./md_input_0_0.out") and os.path.isfile("./md_input_1_0.out")
os.remove("./md_input_0_0.out")
os.remove("./md_input_0_0.md")
os.remove("./md_input_1_0.out")
os.remove("./md_input_1_0.md")
except EnsemblemdError, er:
print "Ensemble MD Toolkit Error: {0}".format(str(er))
raise # Just raise the execption again to get the backtrace