def test_sid_in_mqs(): # FIXME: what is tested / asserted here? appman = Amgr(hostname=host, port=port) sid = appman._sid appman._setup_mqs() qs = ['%s-tmgr-to-sync' % sid, '%s-cb-to-sync' % sid, '%s-sync-to-tmgr' % sid, '%s-sync-to-cb' % sid] mq_connection = pika.BlockingConnection(pika.ConnectionParameters( host=host, port=port)) mq_channel = mq_connection.channel() def callback(): pass for q in qs: try: mq_channel.basic_consume(callback, queue=q, no_ack=True) except Exception as ex: raise EnTKError(ex)
def get_session_description(sid, src=None): if not src: src = './%s/' % sid if not os.path.isdir(src): raise EnTKError('No such directory %s' % src) return ru.read_json('%s/%s.json' % (src, sid))
def get_session_profile(sid, src=None): if not src: src = os.getcwd() if os.path.exists(src): # EnTK profiles are always on localhost profiles = glob.glob("%s/*.prof" % (src)) profiles += glob.glob("%s/*/*.prof" % (src)) else: profiles = glob.glob("./%s/*.prof" % (sid)) profiles += glob.glob("./%s/*/*.prof" % (sid)) if not profiles: raise EnTKError('No profiles found at %s' % src) try: profiles = ru.read_profiles(profiles=profiles, sid=sid) prof, acc = ru.combine_profiles(profiles) prof = ru.clean_profile(prof, sid=sid, state_final=res.FINAL, state_canceled=res.CANCELED) hostmap = get_hostmap(prof) if not hostmap: # FIXME: legacy host notation - deprecated hostmap = get_hostmap_deprecated(profiles) return prof, acc, hostmap except Exception as ex: # Push the exception raised by child functions print(traceback.format_exc()) raise EnTKError('Error: %s' % ex)
def get_session_description(sid, src=None): if not src: src = os.getcwd() if os.path.exists(src): # EnTK profiles are always on localhost desc = ru.read_json("%s/%s/radical.entk.%s.json" % (src, sid, sid)) else: raise EnTKError('%s/%s does not exist' % (src, sid)) return desc
def _check_stage_complete(self): """ Purpose: Check if all tasks of the current stage have completed, i.e., are in either DONE or FAILED state. """ try: for task in self._tasks: if task.state not in [states.DONE, states.FAILED]: return False return True except Exception as ex: raise EnTKError(ex)