# Path: tibanna/awsem.py
# class AwsemRunJson(SerializableObject):
# class AwsemRunJsonJob(SerializableObject):
# class AwsemRunJsonLog(SerializableObject):
# class AwsemRunJsonApp(SerializableObject):
# class AwsemRunJsonInput(SerializableObject):
# class AwsemRunJsonInputFile(SerializableObject):
# class AwsemRunJsonOutput(SerializableObject):
# class AwsemPostRunJson(AwsemRunJson):
# class AwsemPostRunJsonJob(AwsemRunJsonJob):
# class AwsemPostRunJsonOutput(AwsemRunJsonOutput):
# class AwsemPostRunJsonOutputFile(SerializableObject):
#     def __init__(self, Job=None, config=None, strict=True):
#     def create_Job(self, Job, strict=True):
#     def __init__(self, App=None, Input=None, Output=None, JOBID='',
#                  start_time=None, Log=None, strict=True):
#     def create_Output(self, Output):
#     def update(self, **kwargs):
#     def start_time_as_datetime(self):
#     def __init__(self, log_bucket_directory=None):
#     def __init__(self, App_name=None, App_version=None, language=None,
#                  cwl_url=None, main_cwl=None, other_cwl_files=None,
#                  wdl_url=None, main_wdl=None, other_wdl_files=None, workflow_engine=None,
#                  container_image=None, command=None,
#                  snakemake_url=None, main_snakemake=None, other_snakemake_files=None):
#     def __init__(self, Input_files_data=None, Input_parameters=None, Secondary_files_data=None,
#                  # Input_files_reference is for older postrunjson
#                  # Env is missing in older postrunjson
#                  Input_files_reference=None, Env=None):
#     def as_dict_as_cwl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def as_dict_as_wdl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def check_input_files_key_compatibility(self, language):
#     def __init__(self, path, profile='', rename='', unzip='', mount=False, **kwargs):  # kwargs includes 'dir' and 'class'
#     def as_dict(self):
#     def as_dict_as_cwl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def as_dict_as_wdl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def __init__(self, output_bucket_directory=None, output_target=None,
#                  secondary_output_target=None, alt_cond_output_argnames=None):
#     def alt_output_target(self, argname_list):
#     def __init__(self, Job=None, config=None, commands=None,log=None, strict=True):
#     def add_commands(self, command):
#     def create_Job(self, Job, strict=True):
#     def __init__(self, App=None, Input=None, Output=None, JOBID='',
#                  start_time=None, end_time=None, status=None, Log=None,
#                  total_input_size=None, total_output_size=None, total_tmp_size=None,
#                  # older postrunjsons don't have these fields
#                  filesystem='', instance_id='', instance_availablity_zone='',
#                  Metrics=None, strict=True):
#     def create_Output(self, Output):
#     def end_time_as_datetime(self):
#     def add_filesystem(self, filesystem):
#     def __init__(self, output_bucket_directory=None, output_target=None,
#                  secondary_output_target=None, alt_cond_output_argnames=None,
#                  **kwargs):  # kwargs includes 'Output files'
#     def output_files(self):
#     def add_output_files(self, output_files):
#     def as_dict(self):
#     def __init__(self, path, target=None, basename=None, checksum=None,
#                  location=None, md5sum=None, size=None, secondaryFiles=None,
#                  **kwargs):  # kwargs includes 'class'
#     def add_target(self, target):
#     def as_dict(self):
# def file2cwlfile(filename, dirname, unzip):
# def file2wdlfile(filename, dirname, unzip):
# 
# Path: tibanna/exceptions.py
# class MalFormattedRunJsonException(Exception):
#     pass


import pytest
import copy
from tibanna import awsem
from tibanna.exceptions import MalFormattedRunJsonException
            "path": "/data1/out/out.pairs.gz.px2",
            "size": 12931458,
            "target": "somepairs.pairs.gz.px2"
          }
        ],
        "size": 2282418874,
        "target": "somepairs.pairs.gz"
    }


@pytest.fixture
def postrun_json_job(run_json_job):
    json = copy.deepcopy(run_json_job)
    json.update({
        "end_time": "20190531-04:24:55-UTC",
        "filesystem": "/dev/nvme1n1",
        "instance_id": "i-08d1c54ed1f74ab36",
        "status": "0",
        "total_input_size": "2.2G",
        "total_output_size": "4.2G",
        "total_tmp_size": "7.4G",
        "Metrics": {
            "max_mem_used_MB": 13250.1,
            "min_mem_available_MB": 18547.51953125,
            "total_mem_MB": 31797.67578125,
            "max_mem_utilization_percent": 41.67020363737768,
            "max_cpu_utilization_percent": 99.4,
            "max_disk_space_utilization_percent": 40.5262269248086,
            "max_disk_space_used_GB": 15
        }

# Path: tibanna/awsem.py
# class AwsemRunJson(SerializableObject):
# class AwsemRunJsonJob(SerializableObject):
# class AwsemRunJsonLog(SerializableObject):
# class AwsemRunJsonApp(SerializableObject):
# class AwsemRunJsonInput(SerializableObject):
# class AwsemRunJsonInputFile(SerializableObject):
# class AwsemRunJsonOutput(SerializableObject):
# class AwsemPostRunJson(AwsemRunJson):
# class AwsemPostRunJsonJob(AwsemRunJsonJob):
# class AwsemPostRunJsonOutput(AwsemRunJsonOutput):
# class AwsemPostRunJsonOutputFile(SerializableObject):
#     def __init__(self, Job=None, config=None, strict=True):
#     def create_Job(self, Job, strict=True):
#     def __init__(self, App=None, Input=None, Output=None, JOBID='',
#                  start_time=None, Log=None, strict=True):
#     def create_Output(self, Output):
#     def update(self, **kwargs):
#     def start_time_as_datetime(self):
#     def __init__(self, log_bucket_directory=None):
#     def __init__(self, App_name=None, App_version=None, language=None,
#                  cwl_url=None, main_cwl=None, other_cwl_files=None,
#                  wdl_url=None, main_wdl=None, other_wdl_files=None, workflow_engine=None,
#                  container_image=None, command=None,
#                  snakemake_url=None, main_snakemake=None, other_snakemake_files=None):
#     def __init__(self, Input_files_data=None, Input_parameters=None, Secondary_files_data=None,
#                  # Input_files_reference is for older postrunjson
#                  # Env is missing in older postrunjson
#                  Input_files_reference=None, Env=None):
#     def as_dict_as_cwl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def as_dict_as_wdl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def check_input_files_key_compatibility(self, language):
#     def __init__(self, path, profile='', rename='', unzip='', mount=False, **kwargs):  # kwargs includes 'dir' and 'class'
#     def as_dict(self):
#     def as_dict_as_cwl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def as_dict_as_wdl_input(self, input_dir='', input_mount_dir_prefix=''):
#     def __init__(self, output_bucket_directory=None, output_target=None,
#                  secondary_output_target=None, alt_cond_output_argnames=None):
#     def alt_output_target(self, argname_list):
#     def __init__(self, Job=None, config=None, commands=None,log=None, strict=True):
#     def add_commands(self, command):
#     def create_Job(self, Job, strict=True):
#     def __init__(self, App=None, Input=None, Output=None, JOBID='',
#                  start_time=None, end_time=None, status=None, Log=None,
#                  total_input_size=None, total_output_size=None, total_tmp_size=None,
#                  # older postrunjsons don't have these fields
#                  filesystem='', instance_id='', instance_availablity_zone='',
#                  Metrics=None, strict=True):
#     def create_Output(self, Output):
#     def end_time_as_datetime(self):
#     def add_filesystem(self, filesystem):
#     def __init__(self, output_bucket_directory=None, output_target=None,
#                  secondary_output_target=None, alt_cond_output_argnames=None,
#                  **kwargs):  # kwargs includes 'Output files'
#     def output_files(self):
#     def add_output_files(self, output_files):
#     def as_dict(self):
#     def __init__(self, path, target=None, basename=None, checksum=None,
#                  location=None, md5sum=None, size=None, secondaryFiles=None,
#                  **kwargs):  # kwargs includes 'class'
#     def add_target(self, target):
#     def as_dict(self):
# def file2cwlfile(filename, dirname, unzip):
# def file2wdlfile(filename, dirname, unzip):
# 
# Path: tibanna/exceptions.py
# class MalFormattedRunJsonException(Exception):
#     pass


# Path: tests/tibanna/unicorn/test_awsem.py
import pytest
import copy
from tibanna import awsem
from tibanna.exceptions import MalFormattedRunJsonException

            "path": "/data1/out/out.pairs.gz.px2",
            "size": 12931458,
            "target": "somepairs.pairs.gz.px2"
          }
        ],
        "size": 2282418874,
        "target": "somepairs.pairs.gz"
    }


@pytest.fixture
def postrun_json_job(run_json_job):
    json = copy.deepcopy(run_json_job)
    json.update({
        "end_time": "20190531-04:24:55-UTC",
        "filesystem": "/dev/nvme1n1",
        "instance_id": "i-08d1c54ed1f74ab36",
        "status": "0",
        "total_input_size": "2.2G",
        "total_output_size": "4.2G",
        "total_tmp_size": "7.4G",
        "Metrics": {
            "max_mem_used_MB": 13250.1,
            "min_mem_available_MB": 18547.51953125,
            "total_mem_MB": 31797.67578125,
            "max_mem_utilization_percent": 41.67020363737768,
            "max_cpu_utilization_percent": 99.4,
            "max_disk_space_utilization_percent": 40.5262269248086,
            "max_disk_space_used_GB": 15
        }

    })