def _deploy_helper(filename, module_name, get_module, get_today_fn, hash_check=True, auth=None): """Deploys a file to the Artifactory BEL namespace cache :param str filename: The physical path :param str module_name: The name of the module to deploy to :param tuple[str] auth: A pair of (str username, str password) to give to the auth keyword of the constructor of :class:`artifactory.ArtifactoryPath`. Defaults to the result of :func:`get_arty_auth`. :return: The resource path, if it was deployed successfully, else none. :rtype: Optional[str] """ path = ArtifactoryPath( get_module(module_name), auth=get_arty_auth() if auth is None else auth ) path.mkdir(exist_ok=True) if hash_check: deployed_semantic_hashes = { get_bel_resource_hash(subpath.as_posix()) for subpath in path } semantic_hash = get_bel_resource_hash(filename) if semantic_hash in deployed_semantic_hashes: return # Don't deploy if it's already uploaded target = path / get_today_fn(module_name) target.deploy_file(filename) log.info('deployed %s', module_name) return target.as_posix()
help="URL to custom BlobConverter URL to be used for conversion", required=False) args = parser.parse_args() if None in (args.username, args.password): parser.print_help() sys.exit(1) if args.blobconverter_url is not None: blobconverter.set_defaults(url=args.blobconverter_url) path = ArtifactoryPath( "https://artifacts.luxonis.com/artifactory/blobconverter-backup/blobs", auth=(args.username, args.password)) if not path.exists(): path.mkdir() priority_models = [ "mobilenet-ssd", "efficientnet-b0", "vehicle-license-plate-detection-barrier-0106", "vehicle-detection-adas-0002", "license-plate-recognition-barrier-0007" "vehicle-attributes-recognition-barrier-0039", "face-detection-retail-0004", "landmarks-regression-retail-0009" ] backup_shaves = range(1, 17) for model_name, shaves in itertools.product(priority_models, backup_shaves): print("Deploying {} with {} shaves...".format(model_name, shaves)) try: path.deploy_file(blobconverter.from_zoo(model_name, shaves=shaves)) except Exception as ex: