radical-cybertools / radical.pilot

RADICAL-Pilot
http://radical-cybertools.github.io/radical-pilot/index.html
Other
54 stars 23 forks source link

API simplification proposal #2841

Open andre-merzky opened 1 year ago

andre-merzky commented 1 year ago

Our example codes and virtually all application codes currently use the same sequence for application initialization:

session = rp.Session()
tmgr    = rp.TaskManager(session)
pmgr    = rp.PilotManager(session)

pilot   = pmgr.submit_pilots(...)
tmgr.add_pilots(pilot)

tasks   = tmgr.submit_tasks(...)
tmgr.wait_tasks()

With a backward-compatible addition of two calls to the rp.Session() object, that initialization can be significantly simplified to:

session = rp.Session()
pilot   = session.submit_pilots(...)
tasks   = session.submit_tasks(...)
session.wait_tasks()

In the most common use case, the application does not even need the pilot and task handles, thus further simplifying to:

session = rp.Session()
session.submit_pilots(...)
session.submit_tasks(...)
session.wait_tasks()

The session would internally hold a private PilotManager and TaskManager and simply proxy those calls.