示例#1
0
class DBS3LiteClient(object):
    def __init__(self, url):
        self._reader_url = '%s/%s' % (url, 'DBSReader')
        self._writer_url = '%s/%s' % (url, 'DBSWriter')
        self._migrate_url = '%s/%s' % (url, 'DBSMigrate')
        self._gjrc = GridJSONRestClient(
            cert_errror_msg='VOMS proxy needed to query DBS3!',
            cert_errror_cls=UserError)

    def listBlocks(self, **kwargs):
        return self._gjrc.get(url=self._reader_url,
                              api='blocks',
                              params=kwargs)

    def listFiles(self, **kwargs):
        return self._gjrc.get(url=self._reader_url, api='files', params=kwargs)

    def listFileParents(self, **kwargs):
        return self._gjrc.get(url=self._reader_url,
                              api='fileparents',
                              params=kwargs)

    def insertBulkBlock(self, data):
        return self._gjrc.post(url=self._writer_url,
                               api='bulkblocks',
                               data=data)

    def migrateSubmit(self, data):
        return self._gjrc.post(url=self._migrate_url, api='submit', data=data)

    def migrateStatus(self, **kwargs):
        return self._gjrc.get(url=self._migrate_url,
                              api='status',
                              params=kwargs)
class DBS3LiteClient(object):
    def __init__(self, url):
        self._reader_url = '%s/%s' % (url, 'DBSReader')
        self._writer_url = '%s/%s' % (url, 'DBSWriter')
        self._migrate_url = '%s/%s' % (url, 'DBSMigrate')
        self._gjrc = GridJSONRestClient(
            get_cms_cert(create_config()),
            cert_error_msg='VOMS proxy needed to query DBS3!',
            cert_error_cls=UserError)

    def get_dbs_block_list(self, **kwargs):
        return self._gjrc.get(url=self._reader_url,
                              api='blocks',
                              params=kwargs)

    def get_dbs_file_list(self, **kwargs):
        return self._gjrc.get(url=self._reader_url, api='files', params=kwargs)

    def insert_dbs_block_dump(self, data):
        return self._gjrc.post(url=self._writer_url,
                               api='bulkblocks',
                               data=data)

    def migration_request_status(self, **kwargs):
        return self._gjrc.get(url=self._migrate_url,
                              api='status',
                              params=kwargs)

    def migration_request_submit(self, data):
        return self._gjrc.post(url=self._migrate_url, api='submit', data=data)
class DBS3LiteClient(object):
	def __init__(self, url):
		self._reader_url = '%s/%s' % (url, 'DBSReader')
		self._writer_url = '%s/%s' % (url, 'DBSWriter')
		self._migrate_url = '%s/%s' % (url, 'DBSMigrate')
		self._gjrc = GridJSONRestClient(get_cms_cert(create_config()),
			cert_error_msg='VOMS proxy needed to query DBS3!', cert_error_cls=UserError)

	def get_dbs_block_list(self, **kwargs):
		return self._gjrc.get(url=self._reader_url, api='blocks', params=kwargs)

	def get_dbs_file_list(self, **kwargs):
		return self._gjrc.get(url=self._reader_url, api='files', params=kwargs)

	def insert_dbs_block_dump(self, data):
		return self._gjrc.post(url=self._writer_url, api='bulkblocks', data=data)

	def migration_request_status(self, **kwargs):
		return self._gjrc.get(url=self._migrate_url, api='status', params=kwargs)

	def migration_request_submit(self, data):
		return self._gjrc.post(url=self._migrate_url, api='submit', data=data)
class DBS3LiteClient(object):
	def __init__(self, url):
		self._reader_url = '%s/%s' % (url, 'DBSReader')
		self._writer_url = '%s/%s' % (url, 'DBSWriter')
		self._migrate_url = '%s/%s' % (url, 'DBSMigrate')
		self._gjrc = GridJSONRestClient(cert_errror_msg = 'VOMS proxy needed to query DBS3!', cert_errror_cls = UserError)

	def listBlocks(self, **kwargs):
		return self._gjrc.get(url=self._reader_url, api='blocks', params=kwargs)

	def listFiles(self, **kwargs):
		return self._gjrc.get(url=self._reader_url, api='files', params=kwargs)

	def listFileParents(self, **kwargs):
		return self._gjrc.get(url=self._reader_url, api='fileparents', params=kwargs)

	def insertBulkBlock(self, data):
		return self._gjrc.post(url=self._writer_url, api='bulkblocks', data=data)

	def migrateSubmit(self, data):
		return self._gjrc.post(url=self._migrate_url, api='submit', data=data)

	def migrateStatus(self, **kwargs):
		return self._gjrc.get(url=self._migrate_url, api='status', params=kwargs)