Skip to content

Commit 774a46c

Browse files
committed
update slack message
1 parent 26198d7 commit 774a46c

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

sdgym/run_benchmark/run_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main():
5757
)
5858

5959
append_benchmark_run(aws_access_key_id, aws_secret_access_key, date_str)
60-
post_benchmark_launch_message()
60+
post_benchmark_launch_message(date_str)
6161

6262

6363
if __name__ == '__main__':

sdgym/run_benchmark/utils.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
SYNTHESIZERS_SPLIT = [
1616
['UniformSynthesizer', 'ColumnSynthesizer', 'GaussianCopulaSynthesizer'],
1717
['TVAESynthesizer'],
18-
['CopulaGANSynthesizer'],
19-
['CTGANSynthesizer'],
20-
['RealTabFormerSynthesizer'],
2118
]
2219

20+
"""
21+
['CopulaGANSynthesizer'],
22+
['CTGANSynthesizer'],
23+
['RealTabFormerSynthesizer'],
24+
"""
25+
2326

2427
def get_result_folder_name(date_str):
2528
"""Get the result folder name based on the date string."""
@@ -49,18 +52,20 @@ def post_slack_message(channel, text):
4952
client.chat_postMessage(channel=channel, text=text)
5053

5154

52-
def post_benchmark_launch_message():
55+
def post_benchmark_launch_message(date_str):
5356
"""Post a message to the SDV Alerts Slack channel when the benchmark is launched."""
5457
channel = DEBUG_SLACK_CHANNEL
55-
body = 'SDGym benchmark has been launched! Results will be available soon.'
58+
body = '🏃 SDGym benchmark has been launched! EC2 Instances are running. '
59+
body += 'Intermediate results can be found '
60+
body += f'<{OUTPUT_DESTINATION_AWS}{get_result_folder_name(date_str)} |here>.\n'
5661
post_slack_message(channel, body)
5762

5863

5964
def post_run_summary(folder_name):
6065
"""Post run summary to sdv-alerts slack channel."""
6166
channel = DEBUG_SLACK_CHANNEL
6267
body = ''
63-
body += f'SDGym benchmark results for {folder_name} are available!\n'
68+
body += f'🤸🏻‍♀️ SDGym benchmark results for {folder_name} are available!🏋️‍♀️ \n'
6469
body += (
6570
f'Check the results <{OUTPUT_DESTINATION_AWS}{folder_name}/{folder_name}_summary'
6671
'.csv|here>.\n'

tests/unit/run_benchmark/test_run_benchmark.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from botocore.exceptions import ClientError
66

77
from sdgym.run_benchmark.run_benchmark import append_benchmark_run, main
8-
from sdgym.run_benchmark.utils import OUTPUT_DESTINATION_AWS, SYNTHESIZERS
8+
from sdgym.run_benchmark.utils import OUTPUT_DESTINATION_AWS, SYNTHESIZERS_SPLIT
99

1010

1111
@patch('sdgym.run_benchmark.run_benchmark.get_s3_client')
@@ -103,7 +103,13 @@ def test_append_benchmark_run_new_file(
103103
@patch('sdgym.run_benchmark.run_benchmark.benchmark_single_table_aws')
104104
@patch('sdgym.run_benchmark.run_benchmark.os.getenv')
105105
@patch('sdgym.run_benchmark.run_benchmark.append_benchmark_run')
106-
def test_main(mock_append_benchmark_run, mock_getenv, mock_benchmark_single_table_aws):
106+
@patch('sdgym.run_benchmark.run_benchmark.post_benchmark_launch_message')
107+
def test_main(
108+
mock_post_benchmark_launch_message,
109+
mock_append_benchmark_run,
110+
mock_getenv,
111+
mock_benchmark_single_table_aws,
112+
):
107113
"""Test the `main` method."""
108114
# Setup
109115
mock_getenv.side_effect = ['my_access_key', 'my_secret_key']
@@ -116,13 +122,14 @@ def test_main(mock_append_benchmark_run, mock_getenv, mock_benchmark_single_tabl
116122
mock_getenv.assert_any_call('AWS_ACCESS_KEY_ID')
117123
mock_getenv.assert_any_call('AWS_SECRET_ACCESS_KEY')
118124
expected_calls = []
119-
for synthesizer in SYNTHESIZERS:
125+
for synthesizer in SYNTHESIZERS_SPLIT:
120126
expected_calls.append(
121127
call(
122128
output_destination=OUTPUT_DESTINATION_AWS,
123129
aws_access_key_id='my_access_key',
124130
aws_secret_access_key='my_secret_key',
125-
synthesizers=[synthesizer],
131+
synthesizers=synthesizer,
132+
sdv_datasets=['expedia_hotel_logs', 'fake_companies'],
126133
compute_privacy_score=False,
127134
)
128135
)
@@ -133,3 +140,4 @@ def test_main(mock_append_benchmark_run, mock_getenv, mock_benchmark_single_tabl
133140
'my_secret_key',
134141
date,
135142
)
143+
mock_post_benchmark_launch_message.assert_called_once_with(date)

0 commit comments

Comments
 (0)