Skip to content

Commit

Permalink
add more debug Info
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed Nov 4, 2021
1 parent 95de386 commit 90ef647
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,14 @@ def load_csv_data(
config_path = os.path.join(data_dir, 'config.yaml')

with open(config_path, 'r') as f:
print(f'load config from {config_path}')
config = yaml.full_load(f)

space = config.get('space', None)
assert space is not None
if not space_name:
space_name = space.get('name', "A" + space_generator())
print(f'create space {space_name}')

space_desc = SpaceDesc(
name=space_name,
Expand All @@ -421,17 +423,20 @@ def load_csv_data(
)

create_space(space_desc, sess)
print(f'create space {space_name} successfully')

schemas = config['schema']
for line in schemas.splitlines():
resp_ok(sess, line.strip(), True)
print(f'create schema successfully')

# wait heartbeat_interval_secs + 1 seconds for schema synchronization
time.sleep(2)

print(f'load data from {data_dir}')
for fd in config["files"]:
_load_data_from_file(sess, data_dir, fd)

print(f'load data successfully')
return space_desc


Expand All @@ -441,6 +446,9 @@ def get_conn_pool(host: str, port: int):
config.timeout = 180000
# init connection pool
pool = ConnectionPool()
print("get pool")
if not pool.init([(host, port)], config):
raise Exception("Fail to init connection pool.")

print("pool init")
return pool
5 changes: 5 additions & 0 deletions tests/nebula-test-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def start_nebula(nb, configs):
# Load csv data
pool = get_conn_pool(address, ports[0])
sess = pool.get_session(configs.user, configs.password)
print('get session')

if not os.path.exists(TMP_DIR):
os.mkdir(TMP_DIR)
Expand All @@ -113,9 +114,13 @@ def start_nebula(nb, configs):
if not os.path.exists(os.path.join(folder, space, "config.yaml")):
continue
data_dir = os.path.join(folder, space)
print('load csv data')
space_desc = load_csv_data(sess, data_dir, space)
print('load csv data done')
spaces.append(space_desc.__dict__)
print(space)
f.write(json.dumps(spaces))
print('SPACE_TMP_PATH')

with open(NB_TMP_PATH, "w") as f:
data = {
Expand Down

0 comments on commit 90ef647

Please sign in to comment.