from datetime import datetime


def generate_slurm_jobs_sql(start: str,end: str):
    """generate_slurm_jobs_sql Generate Slurm Jobs Sql

    Generate Sql for querying slurm jobs info

    Args:
        start (str): start time
        end (str): end time

    Returns:
        string: sql string
    """
    utc_from = datetime.strptime(start, '%Y-%m-%dT%H:%M:%S.%fZ')
    epoch_from = int((utc_from - datetime(1970, 1, 1)).total_seconds())
    utc_to = datetime.strptime(end, '%Y-%m-%dT%H:%M:%S.%fZ')
    epoch_to = int((utc_to - datetime(1970, 1, 1)).total_seconds())

    sql = f"SELECT * FROM slurm.jobs \
            WHERE start_time < {epoch_to} \
            AND end_time > {epoch_from};"
    return sql