bmonreporter/reporter.py
def process_repo(git_info: dict):
    """Processes one GitHub repo containing notebook report templates and configuration info
    indicating which servers the reports should be applied to, what Jupyter theme to use, and
    where to store the final reports.
    'git_info' is a dictionary with at least a 'git_spec' key that gives the address that 
    should be given to 'git clone' to clone the repo.  A second, optional, key is 'branch'
    which gives the repo branch to use.  If that key is not present, the 'master' branch
    is used.
    """
    try:
        # make a temporary directory to clone the repo into.
        repo_dir = tempfile.TemporaryDirectory(prefix=f'repo_')
        repo_path = Path(repo_dir.name)

        # clone the repo into this directory.
        git_spec = git_info['git_spec']
        git_branch = git_info.get('branch', 'master')   # default to master branch.
        subprocess.run(f'git clone -b {git_branch} --depth 1 {git_spec} {repo_dir.name}', shell=True, check=True)

        # read the contents of the YAML configuration file in the root of the repo.
        config = yaml.load(open(repo_path / 'config.yaml'), Loader=yaml.SafeLoader)

        # execute the Jupyter theme command found in the config file. This will format the
        # notebooks as desired by the user.
        subprocess.run(config['jup_theme_cmd'], shell=True, check=True)

        # get the output directory or S3 bucket/key from the config file.
        output_dir = config['output_dir']

        # make a Path object pointing to the template directory in the repo
        template_path = repo_path / 'templates'

        # loop through the BMON servers that are targeted by this repo and process
        for server_url in config['bmon_urls']:
            process_server(server_url, template_path, output_dir) 

    except:
        logging.exception(f'Error processing Git repo {git_info}')

    finally:
        # remove the temporary directory
        repo_dir.cleanup()
Processes one GitHub repo containing notebook report templates and configuration info
    indicating which servers the reports should be applied to, what Jupyter theme to use, and
    where to store the final reports.
    'git_info' is a dictionary with at least a 'git_spec' key that gives the address that 
    should be given to 'git clone' to clone the repo.  A second, optional, key is 'branch'
    which gives the repo branch to use.  If that key is not present, the 'master' branch
    is used.
    
Processes one GitHub repo containing notebook report templates and configuration info
indicating which servers the reports should be applied to, what Jupyter theme to use, and
where to store the final reports.
Processes one GitHub repo containing notebook report templates and configuration info indicating which servers the reports should be applied to what Jupyter theme to use and where to store the final reports .
def process_repo(git_info: dict):
    try:
        repo_dir = tempfile.TemporaryDirectory(prefix=f'repo_')
        repo_path = Path(repo_dir.name)
        git_spec = git_info['git_spec']
        git_branch = git_info.get('branch', 'master')   
        subprocess.run(f'git clone -b {git_branch} --depth 1 {git_spec} {repo_dir.name}', shell=True, check=True)
        config = yaml.load(open(repo_path / 'config.yaml'), Loader=yaml.SafeLoader)
        subprocess.run(config['jup_theme_cmd'], shell=True, check=True)
        output_dir = config['output_dir']
        template_path = repo_path / 'templates'
        for server_url in config['bmon_urls']:
            process_server(server_url, template_path, output_dir) 
    except:
        logging.exception(f'Error processing Git repo {git_info}')
    finally:
        repo_dir.cleanup()
def process_repo ( git_info : dict ) : try : repo_dir = tempfile . TemporaryDirectory ( prefix = f'repo_' ) repo_path = Path ( repo_dir . name ) git_spec = git_info [ 'git_spec' ] git_branch = git_info . get ( 'branch' , 'master' ) subprocess . run ( f'git clone -b {git_branch} --depth 1 {git_spec} {repo_dir.name}' , shell = True , check = True ) config = yaml . load ( open ( repo_path / 'config.yaml' ) , Loader = yaml . SafeLoader ) subprocess . run ( config [ 'jup_theme_cmd' ] , shell = True , check = True ) output_dir = config [ 'output_dir' ] template_path = repo_path / 'templates' for server_url in config [ 'bmon_urls' ] : process_server ( server_url , template_path , output_dir ) except : logging . exception ( f'Error processing Git repo {git_info}' ) finally : repo_dir . cleanup ( )
Processes one GitHub repo containing notebook report templates and configuration info
indicating which servers the reports should be applied to, what Jupyter theme to use, and
where to store the final reports.
Processes one GitHub repo containing notebook report templates and configuration info indicating which servers the reports should be applied to what Jupyter theme to use and where to store the final reports .
"""Processes one GitHub repo containing notebook report templates and configuration info
    indicating which servers the reports should be applied to, what Jupyter theme to use, and
    where to store the final reports.
    'git_info' is a dictionary with at least a 'git_spec' key that gives the address that 
    should be given to 'git clone' to clone the repo.  A second, optional, key is 'branch'
    which gives the repo branch to use.  If that key is not present, the 'master' branch
    is used.
    """ # make a temporary directory to clone the repo into. # clone the repo into this directory. # default to master branch. # read the contents of the YAML configuration file in the root of the repo. # execute the Jupyter theme command found in the config file. This will format the # notebooks as desired by the user. # get the output directory or S3 bucket/key from the config file. # make a Path object pointing to the template directory in the repo # loop through the BMON servers that are targeted by this repo and process # remove the temporary directory
git_info
dict