diff --git a/sdgym/benchmark.py b/sdgym/benchmark.py index fd70444..423d4ad 100644 --- a/sdgym/benchmark.py +++ b/sdgym/benchmark.py @@ -443,6 +443,7 @@ def _get_empty_dataframe(compute_quality_score, sdmetrics): return scores +<<<<<<< HEAD def _directory_exists(bucket_name, s3_file_path): # Find the last occurrence of '/' in the file path last_slash_index = s3_file_path.rfind('/') @@ -484,6 +485,19 @@ def _parse_s3_path(s3_path): def _create_sdgym_script(params, output_filepath): bucket_name, key_name = _parse_s3_path(output_filepath) +======= +def _create_sdgym_script(params, output_filepath): + first_slash_index = output_filepath.find('/') # Find the index of the first slash + bucket_name = '' + key_name = '' + if first_slash_index != -1: # Check if a slash is found + bucket_name = output_filepath[:first_slash_index] # Extract directory part + key_name = output_filepath[first_slash_index + 1:] # Extract filename part + else: + raise ValueError("""Invalid output_filepath. + The path should be structured as: / + Please make sure the path exists and permissions are given.""") +>>>>>>> 8d58603 (Remove bumpversion and use bump-my-version (#271)) session = boto3.session.Session() credentials = session.get_credentials() synthesizer_string = 'synthesizers=[' @@ -532,7 +546,11 @@ def _create_instance_on_ec2(script_content): ec2_client = boto3.client('ec2') session = boto3.session.Session() credentials = session.get_credentials() +<<<<<<< HEAD print(f'This instance is being created in region: {session.region_name}') # noqa +======= + print(f'This instance is being created in region: {session.region_name}') # noqa +>>>>>>> 8d58603 (Remove bumpversion and use bump-my-version (#271)) # User data script to install the library user_data_script = f"""#!/bin/bash @@ -588,7 +606,11 @@ def _create_instance_on_ec2(script_content): instance_id = response['Instances'][0]['InstanceId'] waiter = ec2_client.get_waiter('instance_status_ok') waiter.wait(InstanceIds=[instance_id]) +<<<<<<< HEAD print(f'Job kicked off for SDGym on {instance_id}') # noqa +======= + print(f'Job kicked off for SDGym on {instance_id}') # noqa +>>>>>>> 8d58603 (Remove bumpversion and use bump-my-version (#271)) def benchmark_single_table(synthesizers=DEFAULT_SYNTHESIZERS, custom_synthesizers=None, @@ -656,7 +678,11 @@ def benchmark_single_table(synthesizers=DEFAULT_SYNTHESIZERS, custom_synthesizer A table containing one row per synthesizer + dataset + metric. """ if run_on_ec2: +<<<<<<< HEAD print("This will create an instance for the current AWS user's account.") # noqa +======= + print("This will create an instance for the current AWS user's account.") # noqa +>>>>>>> 8d58603 (Remove bumpversion and use bump-my-version (#271)) if output_filepath is not None: script_content = _create_sdgym_script(dict(locals()), output_filepath) _create_instance_on_ec2(script_content) diff --git a/tests/unit/test_benchmark.py b/tests/unit/test_benchmark.py index 1eb59df..c864078 100644 --- a/tests/unit/test_benchmark.py +++ b/tests/unit/test_benchmark.py @@ -4,7 +4,11 @@ import pytest from sdgym import benchmark_single_table +<<<<<<< HEAD from sdgym.benchmark import _check_write_permissions, _create_sdgym_script, _directory_exists +======= +from sdgym.benchmark import _create_sdgym_script +>>>>>>> 8d58603 (Remove bumpversion and use bump-my-version (#271)) from sdgym.synthesizers import CTGANSynthesizer, GaussianCopulaSynthesizer