Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
WIP - HuggingFace launcher
Browse filesFiles changed (2)
1Subproject commit 308c8e5110eeea4ae5ff6adcb927c7c8eb2259f01Subproject commit 868a3f7c85cdc522b43315d946b0c32686cf3712
11 unmodified lines1213141516171819202122233 unmodified lines2728293031323334353637387 unmodified lines46474849505172 unmodified lines12412512612712812913013113213 unmodified lines14614714814915015115215315415515615753 unmodified lines21121221321421521621721821922022145 unmodified lines26726826927027127227311 unmodified linesroot_data_dir_path = pathlib.Path(root_data_dir).resolve()print(f"{root_data_dir_path=}")artifacts_dir_path = root_data_dir_path / "artifacts"logs_dir_path = root_data_dir_path / "logs"root_data_dir_path.mkdir(parents=True, exist_ok=True)artifacts_dir_path.mkdir(parents=True, exist_ok=True)logs_dir_path.mkdir(parents=True, exist_ok=True)# endregion# region: DB Configuration3 unmodified lines# endregion# region: Storage configurationfrom cloud_pipelines.orchestration.storage_providers import local_storagestorage_provider = local_storage.LocalStorageProvider()artifacts_root_uri = artifacts_dir_path.as_posix()logs_root_uri = logs_dir_path.as_posix()# endregion# region: Launcher configuration7 unmodified lines# client=docker_client,# )launcher = None# endregion# region: Orchestrator configuration72 unmodified lines# endregion# region: Database engine initializationfrom cloud_pipelines_backend import api_routerdb_engine = api_router.create_db_engine(database_uri=database_uri,)# endregion13 unmodified linesfrom cloud_pipelines_backend import orchestrator_sqldef create_db_and_tables(db_engine: sqlalchemy.Engine):from cloud_pipelines_backend import backend_types_sqlbackend_types_sql._TableBase.metadata.create_all(db_engine)def run_orchestrator(db_engine: sqlalchemy.Engine,storage_provider: storage_interfaces.StorageProvider,53 unmodified linesfrom fastapi import staticfilesfrom cloud_pipelines_backend import api_router@contextlib.asynccontextmanagerasync def lifespan(app: fastapi.FastAPI):create_db_and_tables(db_engine=db_engine)threading.Thread(target=run_configured_orchestrator,daemon=True,45 unmodified linesfor web_app_dir in web_app_search_dirs:if web_app_dir.exists():found_frontend_build_files = Truelogger.info(f"Found the Web app static files at {str(web_app_dir)}. Mounting them.")# The Web app base URL is currently static and hardcoded.# TODO: Remove this mount once the base URL becomes relative.app.mount(11 unmodified lines1213141516171819202122233 unmodified lines272829303132333435363738394041427 unmodified lines5051525354555657585960616263646566676869707172 unmodified lines14414514614714814915015115213 unmodified lines16616716816917017153 unmodified lines22522622722822923023123223323423523645 unmodified lines28228328428528628728828929011 unmodified linesroot_data_dir_path = pathlib.Path(root_data_dir).resolve()print(f"{root_data_dir_path=}")# artifacts_dir_path = root_data_dir_path / "artifacts"# logs_dir_path = root_data_dir_path / "logs"root_data_dir_path.mkdir(parents=True, exist_ok=True)# artifacts_dir_path.mkdir(parents=True, exist_ok=True)# logs_dir_path.mkdir(parents=True, exist_ok=True)# endregion# region: DB Configuration3 unmodified lines# endregion# region: Storage configuration# from cloud_pipelines.orchestration.storage_providers import local_storage# storage_provider = local_storage.LocalStorageProvider()from cloud_pipelines_backend.storage_providers import huggingface_repo_storagestorage_provider = huggingface_repo_storage.HuggingFaceRepoStorageProvider()# artifacts_root_uri = artifacts_dir_path.as_posix()# logs_root_uri = logs_dir_path.as_posix()artifacts_root_uri = os.environ.get("DATA_DIR_URI")logs_root_uri = artifacts_root_uri# endregion# region: Launcher configuration7 unmodified lines# client=docker_client,# )launcher = Nonetry:from cloud_pipelines_backend.launchers import huggingface_launcherslauncher = huggingface_launchers.HuggingFaceJobsContainerLauncher()except Exception as ex:print(ex)passtry:import huggingface_hubhuggingface_hub.list_repo_tree(repo_id="Ark-kun/tangle_data", repo_type="dataset")except Exception as ex:print(ex)pass# endregion# region: Orchestrator configuration72 unmodified lines# endregion# region: Database engine initializationfrom cloud_pipelines_backend import database_opsdb_engine = database_ops.create_db_engine(database_uri=database_uri,)# endregion13 unmodified linesfrom cloud_pipelines_backend import orchestrator_sqldef run_orchestrator(db_engine: sqlalchemy.Engine,storage_provider: storage_interfaces.StorageProvider,53 unmodified linesfrom fastapi import staticfilesfrom cloud_pipelines_backend import api_routerfrom cloud_pipelines_backend import database_ops@contextlib.asynccontextmanagerasync def lifespan(app: fastapi.FastAPI):database_ops.initialize_and_migrate_db(db_engine=db_engine)threading.Thread(target=run_configured_orchestrator,daemon=True,45 unmodified linesfor web_app_dir in web_app_search_dirs:if web_app_dir.exists():found_frontend_build_files = Truelogger.info(f"Found the Web app static files at {str(web_app_dir)}. Mounting them.")# The Web app base URL is currently static and hardcoded.# TODO: Remove this mount once the base URL becomes relative.app.mount(
backend+1-1
huggingface_overlay/start_HuggingFace.py+35-18