def config(): # -------------------------------------------------------------------------- # class Config(ru.TestConfig): # ---------------------------------------------------------------------- # @staticmethod def configure_jd(cfg, jd): for key in [ 'job_walltime_limit', 'job_project', 'job_queue', 'job_total_cpu_count', 'job_spmd_variation' ]: jd.set_attribute(key, cfg.get(key)) # ---------------------------------------------------------------------- # @staticmethod def assert_exception(cfg, e): ni = cfg.get('not_implemented', 'warn') if 'NotImplemented' in str(e): if ni == 'ignore': pass elif ni == 'warn': print('WARNING: %s' % e) else: assert (False), 'unexpected exception: %s' % e # ---------------------------------------------------------------------- # @staticmethod def silent_cancel(obj): if not isinstance(obj, list): obj = [obj] for o in obj: try: o.cancel() except: pass # -------------------------------------------------------------------------- # return Config(ru.get_test_config())
def test_advert_callback () : try : global check tc = ru.get_test_config () d_1 = saga.advert.Directory (tc.advert_url + '/tmp/test1/test1/', saga.advert.CREATE | saga.advert.CREATE_PARENTS) d_1.set_attribute ('foo', 'bar') d_1.add_callback ('foo', cb ) d_1.set_attribute ('foo', 'baz') assert check # check if callback got invoked check = False except saga.NotImplemented as ni: assert tc.notimpl_warn_only, "%s " % ni if tc.notimpl_warn_only: print "%s " % ni except saga.SagaException as se: assert False, "Unexpected exception: %s" % se
def test_advert_callback(): try: global check tc = ru.get_test_config() d_1 = saga.advert.Directory( tc.advert_url + '/tmp/test1/test1/', saga.advert.CREATE | saga.advert.CREATE_PARENTS) d_1.set_attribute('foo', 'bar') d_1.add_callback('foo', cb) d_1.set_attribute('foo', 'baz') assert check # check if callback got invoked check = False except saga.NotImplemented as ni: assert tc.notimpl_warn_only, "%s " % ni if tc.notimpl_warn_only: print "%s " % ni except saga.SagaException as se: assert False, "Unexpected exception: %s" % se
def config(): ru.set_test_config(ns='radical.saga') ru.add_test_config(ns='radical.saga', cfg_name='fork_localhost') return ru.get_test_config()
@staticmethod def silent_cancel(obj): if not isinstance(obj, list): obj = [obj] for o in obj: try: o.cancel() except: pass # -------------------------------------------------------------------------- # return Config(ru.get_test_config()) # ------------------------------------------------------------------------------ # @pytest.fixture(scope="module") def job_service(session, cfg, request): assert ('job_service_url' in cfg) js = rs.job.Service(cfg['job_service_url'], session=session) def close(): js.close() request.addfinalizer(close)
def config(): ru.set_test_config(ns='radical.saga') ru.add_test_config(ns='radical.saga', cfg_name='advert_redis_local') return ru.get_test_config()