예제 #1
0
파일: cache.py 프로젝트: zhaohb/polyaxon
def _cache_project(config, owner=None, project=None):
    if ProjectManager.is_initialized() and ProjectManager.is_locally_initialized():
        if _is_same_project(owner, project):
            ProjectManager.set_config(config)
            return

    ProjectManager.set_config(config, visibility=ProjectManager.VISIBILITY_GLOBAL)
예제 #2
0
파일: cache.py 프로젝트: zhaohb/polyaxon
def cache(config_manager, config, owner=None, project=None):
    if config_manager == ProjectManager:
        _cache_project(config=config, project=project, owner=owner)

    # Set caching only if we have an initialized project
    if not ProjectManager.is_initialized():
        return

    if not _is_same_project(owner, project):
        return

    visibility = (
        ProjectManager.VISIBILITY_LOCAL
        if ProjectManager.is_locally_initialized()
        else ProjectManager.VISIBILITY_GLOBAL
    )
    config_manager.set_config(config, visibility=visibility)