Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/cli.py
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | except ModuleNotFoundError: | ||||
else: | else: | ||||
graph = None | graph = None | ||||
backend = InMemoryVaultBackend() | backend = InMemoryVaultBackend() | ||||
storage = get_storage(**conf["storage"]) | storage = get_storage(**conf["storage"]) | ||||
objstorage = get_objstorage(**conf["objstorage"]) if "objstorage" in conf else None | objstorage = get_objstorage(**conf["objstorage"]) if "objstorage" in conf else None | ||||
cooker_cls = get_cooker_cls(cooker_name) | cooker_cls = get_cooker_cls(cooker_name) | ||||
cooker = cooker_cls( | cooker = cooker_cls( | ||||
obj_type=cooker_name, | bundle_type=cooker_name, | ||||
obj_id=swhid.object_id, | obj_id=swhid.object_id, | ||||
backend=backend, | backend=backend, | ||||
storage=storage, | storage=storage, | ||||
graph=graph, | graph=graph, | ||||
objstorage=objstorage, | objstorage=objstorage, | ||||
max_bundle_size=None, # No need for a size limit, we are running locally | max_bundle_size=None, # No need for a size limit, we are running locally | ||||
) | ) | ||||
cooker.cook() | cooker.cook() | ||||
try: | try: | ||||
bundle = backend.fetch(cooker_name, swhid.object_id) | bundle = backend.fetch(cooker_name, swhid.object_id) | ||||
except ObjNotFoundError: | except ObjNotFoundError: | ||||
bundle = None | bundle = None | ||||
if bundle is None: | if bundle is None: | ||||
import pdb | |||||
pdb.set_trace() | |||||
raise click.ClickException("Cooker did not write a bundle to the backend.") | raise click.ClickException("Cooker did not write a bundle to the backend.") | ||||
outfile.write(bundle) | outfile.write(bundle) | ||||
@vault.command(name="rpc-serve") | @vault.command(name="rpc-serve") | ||||
@click.option( | @click.option( | ||||
"--config-file", | "--config-file", | ||||
"-C", | "-C", | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |