Skip to content

Commit cdfa203

Browse files
committed
Print runner IP.
1 parent ca6becb commit cdfa203

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

sdks/python/apache_beam/ml/rag/ingestion/alloydb_it_test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
])
6969
registry.register_coder(MetadataConflictRow, RowCoder)
7070

71+
_LOGGER = logging.getLogger(__name__)
7172
VECTOR_SIZE = 768
7273

7374

@@ -141,17 +142,18 @@ def key_on_id(chunk):
141142
return (int(chunk.id.split('_')[1]), chunk)
142143

143144

145+
@unittest.skipUnless(
146+
os.environ.get('ALLOYDB_PORT'),
147+
"ALLOYDB_PORT environment var is not provided")
144148
class AlloyDBVectorWriterConfigTest(unittest.TestCase):
145149
ALLOYDB_TABLE_PREFIX = 'python_rag_alloydb_'
146150

147151
@classmethod
148152
def setUpClass(cls):
149-
cls.host = os.environ.get('ALLOYDB_HOST', '10.0.0.2')
153+
cls.host = os.environ.get('ALLOYDB_HOST', '10.119.0.22')
150154
cls.port = os.environ.get('ALLOYDB_PORT', '5432')
151155
cls.database = os.environ.get('ALLOYDB_DATABASE', 'postgres')
152156
cls.username = os.environ.get('ALLOYDB_USERNAME', 'postgres')
153-
if not os.environ.get('ALLOYDB_PASSWORD'):
154-
raise ValueError("ALLOYDB_PASSWORD is not set.")
155157
cls.password = os.environ.get('ALLOYDB_PASSWORD')
156158

157159
# Create unique table name suffix
@@ -373,7 +375,7 @@ def custom_row_to_chunk(row):
373375
# Extract timestamp from custom_id
374376
timestamp = row.custom_id.split('timestamp_')[1]
375377
# Extract index from timestamp
376-
i = int(timestamp.split('T wrong')[1][:2])
378+
i = int(timestamp.split('T')[1][:2])
377379

378380
# Parse embedding vector
379381
embedding_list = [
@@ -488,7 +490,7 @@ def custom_row_to_chunk(row):
488490

489491
# Verify count
490492
count_result = rows | "Count All" >> beam.combiners.Count.Globally()
491-
assert_that(count_result, equal_to([num_records]), label='count_check')
493+
assert_that(count_result, equal_to([10]), label='count_check')
492494

493495
chunks = rows | "To Chunks" >> beam.Map(custom_row_to_chunk)
494496
assert_that(chunks, equal_to(test_chunks), label='chunks_check')

sdks/python/tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ commands =
117117
# many packages do not support py3.12
118118
# Don't set TMPDIR to avoid "AF_UNIX path too long" errors in certain tests.
119119
setenv =
120+
passenv = ALLOYDB_PASSWORD
120121
extras = test,gcp,dataframe,p312_ml_test
121122
commands =
122123
# Log tensorflow version for debugging

0 commit comments

Comments
 (0)