Open andre-merzky opened 11 months ago
The following code is now possible (in branch feature/pilot_resources
):
#!/usr/bin/env python3
import pprint
import radical.pilot as rp
if __name__ == '__main__':
session = rp.Session()
try:
pmgr = rp.PilotManager(session=session)
tmgr = rp.TaskManager(session=session)
pdesc = rp.PilotDescription({'resource': 'local.localhost',
'runtime' : 15,
'cores' : 256})
pilot = pmgr.submit_pilots([pdesc])[0]
pilot.wait(rp.PMGR_ACTIVE)
nodes = pilot.nodes
pprint.pprint(nodes)
tmgr.add_pilots(pilot)
td1 = rp.TaskDescription({'executable': 'hostname'})
td2 = rp.TaskDescription({
'executable': 'hostname',
'ranks' : 2,
'slots' : [rp.Slot.from_node(nodes[0], core_ids=[1,3]),
rp.Slot.from_node(nodes[1], core_ids=[2,4])]
})
tmgr.submit_tasks([td1, td2])
tmgr.wait_tasks()
finally:
session.close(download=True)
This requirement comes from Muscle3 integration (see https://github.com/radical-cybertools/other_activities/issues/89). This requires:
rp.Pilot
instances (afterPMGR_ACTIVE
)rp.TaskDescriptions.slots
attribute (bypassing the agent scheduler)