本文整理匯總了Python中fireworks.LaunchPad.add_wf方法的典型用法代碼示例。如果您正苦於以下問題:Python LaunchPad.add_wf方法的具體用法?Python LaunchPad.add_wf怎麽用?Python LaunchPad.add_wf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fireworks.LaunchPad
的用法示例。
在下文中一共展示了LaunchPad.add_wf方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import add_wf [as 別名]
def main():
# set up the LaunchPad and reset it
launchpad = LaunchPad()
launchpad.reset('', require_password=False)
# Build the flow
nflows = 2
for i in range(nflows):
flow = build_flow("flow_" + str(i))
flow.build_and_pickle_dump()
# create the Firework consisting of a single task
firework = Firework(FireTaskWithFlow(flow=flow))
# store workflow
launchpad.add_wf(firework)
#launch it locally
#launch_rocket(launchpad)
return 0
示例2: LaunchPad
# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import add_wf [as 別名]
from fireworks import Firework, Workflow, LaunchPad, ScriptTask
from fireworks.core.rocket_launcher import rapidfire
# set up the LaunchPad and reset it
launchpad = LaunchPad()
launchpad.reset('', require_password=False)
# create the individual FireWorks and Workflow
fw1 = Firework(ScriptTask.from_str('echo "hello"'), name="hello")
fw2 = Firework(ScriptTask.from_str('echo "goodbye"'), name="goodbye", parents=[fw1,])
wf = Workflow([fw1, fw2], name="test workflow")
# store workflow and launch it locally
launchpad.add_wf(wf)
rapidfire(launchpad)
示例3: LaunchPad
# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import add_wf [as 別名]
"""
This code is described in the Introductory tutorial, https://materialsproject.github.io/fireworks/introduction.html
"""
from fireworks import Firework, LaunchPad, ScriptTask
from fireworks.core.rocket_launcher import launch_rocket
if __name__ == "__main__":
# set up the LaunchPad and reset it
launchpad = LaunchPad()
# launchpad.reset('', require_password=False)
# create the Firework consisting of a single task
firetask = ScriptTask.from_str('echo "howdy, your job launched successfully!"')
firework = Firework(firetask)
# store workflow and launch it locally
launchpad.add_wf(firework)
launch_rocket(launchpad)
示例4: LaunchPad
# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import add_wf [as 別名]
from fireworks import LaunchPad, Firework, Workflow
from fireworks.core.rocket_launcher import launch_rocket
from fireworks.examples.custom_firetasks.hello_world.hello_world_task import HelloTask
if __name__ == "__main__":
# initialize the database
lp = LaunchPad() # you might need to modify the connection settings here
# lp.reset() # uncomment this line and set the appropriate parameters if you want to reset the database
# create the workflow and store it in the database
my_fw = Firework([HelloTask()])
my_wflow = Workflow.from_Firework(my_fw)
lp.add_wf(my_wflow)
# run the workflow
launch_rocket(lp)
示例5:
# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import add_wf [as 別名]
#==============================================================================
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(
description='Demonstrates Fireworks workflows on OLCF resources.')
parser.add_argument('--reset', action='store_true',
help='Reset the database.')
parser.add_argument('-p', '--push-wf', dest='push_wf', action='store_true',
help='Push demo workflow to DB.')
parser.add_argument('-b', '--block', action='store_true',
help='Create a new output block.')
parser.add_argument('-u', '--update-only', action='store_true',
help='Update the DB, but do not process jobs.')
parser.add_argument('-d', '--daemon-mode', action='store_true',
help='Update the DB, but do not process jobs.')
args = parser.parse_args()
if args.reset:
launchpad.reset('', require_password=False)
if args.push_wf:
launchpad.add_wf(workflow)
if args.block:
from fireworks.utilities.fw_utilities import create_datestamp_dir
create_datestamp_dir(out_dir, launchpad.m_logger)
if not args.update_only:
process_offline(launchpad, launcher_args, args.daemon_mode)
示例6: FireWork
# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import add_wf [as 別名]
Returns:
(Workflow): A workflow containing one FireWork (two FireTasks) which
is automatically set up to run the optimization loop.
"""
spec = {'_x': x}
# ObjectiveFuncTask writes _y field to the spec internally.
firework1 = Firework([ObjectiveFuncTask(), OptTask(**db_info)], spec=spec)
return Workflow([firework1])
if __name__ == "__main__":
# Make a MissionControl object
mc = MissionControl(**db_info)
# Reset the launchpad and optimization db for this example
launchpad.reset(password=None, require_password=False)
mc.reset(hard=True)
# Configure the optimization db with MissionControl
mc.configure(wf_creator=wf_creator, dimensions=x_dim)
# Run the optimization loop 10 times.
launchpad.add_wf(wf_creator([5, 5, 2]))
rapidfire(launchpad, nlaunches=10, sleep_time=0)
# Examine results
plt = mc.plot()
plt.show()
示例7: MissionControl
# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import add_wf [as 別名]
"""
fin_len = x[0]
fin_angle = x[1]
useful_feature1 = fin_len + fin_angle ** 2
useful_feature2 = fin_angle + fin_len
return x + [useful_feature1, useful_feature2]
if __name__ == "__main__":
# Make a MissionControl object
mc = MissionControl(**db_info)
# Reset the launchpad and optimization db for this example
launchpad.reset(password=None, require_password=False)
mc.reset(hard=True)
# Configure the optimization db with MissionControl
mc.configure(wf_creator=wf_creator,
dimensions=x_dim,
acq="maximin",
predictor="GaussianProcessRegressor",
get_z=get_z)
# Run 30 workflows + optimization
launchpad.add_wf(wf_creator([100, 45.0, "dolphin fin"]))
rapidfire(launchpad, nlaunches=30)
# Examine and plot the optimization
plt = mc.plot(print_pareto=True)
plt.show()