def main(args): external_file = args.external_file.rstrip('.external') if os.path.isfile(args.resource_file): fetch_from.process(args.resource_file, os.path.basename(args.resource_file), args, False) return error = None try: with open(args.external_file) as f: js = json.load(f) if js['storage'] == 'SANDBOX': import fetch_from_sandbox as ffsb del args.external_file args.resource_id = js['resource_id'] ffsb.main(args) elif js['storage'] == 'MDS': import fetch_from_mds as fmds del args.external_file args.key = js['resource_id'] fmds.main(args) else: error = 'Unsupported storage in {}'.format(external_file) except: logging.error('Invalid external file: {}'.format(external_file)) raise if error: raise Exception(error)
def main(opts, outputs): custom_fetcher = os.environ.get('YA_CUSTOM_FETCHER') fetched_file, file_name = fetch(opts.resource_id, custom_fetcher) fetch_from.process(fetched_file, file_name, opts, outputs, not custom_fetcher)
def main(args): external_file = args.external_file.rstrip('.external') if os.path.isfile(args.resource_file): fetch_from.process( fetched_file, os.path.splitext(os.path.basename(args.file_name))[0], args, False) return try: with open(args.external_file) as f: js = json.load(f) if js['storage'] == 'SANDBOX': import fetch_from_sandbox as ffsb del args.external_file args.resource_id = js['resource_id'] ffsb.main(args) elif js['storage'] == 'MDS': import fetch_from_mds as fmds del args.external_file args.key = js['resource_id'] fmds.main(args) else: logging.debug('Unsupported storage in %s', external_file) except: logging.debug('Invalid %s', external_file)
def main(args): custom_fetcher = os.environ.get('YA_CUSTOM_FETCHER') fetched_file, file_name = fetch(args.resource_id, custom_fetcher) fetch_from.process(fetched_file, file_name, args, remove=not custom_fetcher)
def main(args): custom_fetcher = os.environ.get('YA_CUSTOM_FETCHER') resource_info = _get_resource_info_from_file(args.resource_file) if resource_info: fetched_file = args.resource_file file_name = resource_info['file_name'] else: # This code should be merged to ya and removed. fetched_file, file_name = fetch(args.resource_id, custom_fetcher) fetch_from.process(fetched_file, file_name, args, remove=not custom_fetcher and not resource_info)
def main(args): fetched_file, resource_file_name = fetch(args.key) fetch_from.process(fetched_file, resource_file_name, args)
def main(opts, outputs): fetched_file, resource_file_name = fetch(opts.key) fetch_from.process(fetched_file, resource_file_name, opts, outputs)
def main(args): file_name = os.path.basename(args.copy_to) fetched_file = fetch(args.name, args.version, args.sky_id, args.integrity, args.integrity_algorithm, file_name) fetch_from.process(fetched_file, file_name, args)
def main(args): archive = args.archive file_name = args.file_name.rstrip('-') fetch_from.process(archive, file_name, args, remove=False)