Merge pull request #25908 from arenadata/ADQM-320

This commit is contained in:
Ilya Yatsishin 2021-07-02 13:25:22 +03:00 committed by GitHub
commit 523155a020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -1188,15 +1188,18 @@ class ClickHouseCluster:
time.sleep(1)
def wait_hdfs_to_start(self, timeout=300):
def wait_hdfs_to_start(self, timeout=300, check_marker=False):
start = time.time()
while time.time() - start < timeout:
try:
self.hdfs_api.write_data("/somefilewithrandomname222", "1")
logging.debug("Connected to HDFS and SafeMode disabled! ")
if check_marker:
self.hdfs_api.read_data("/preparations_done_marker")
return
except Exception as ex:
logging.exception("Can't connect to HDFS " + str(ex))
logging.exception("Can't connect to HDFS or preparations are not done yet " + str(ex))
time.sleep(1)
raise Exception("Can't wait HDFS to start")
@ -1443,7 +1446,7 @@ class ClickHouseCluster:
os.chmod(self.hdfs_kerberized_logs_dir, stat.S_IRWXO)
run_and_check(self.base_kerberized_hdfs_cmd + common_opts)
self.make_hdfs_api(kerberized=True)
self.wait_hdfs_to_start()
self.wait_hdfs_to_start(check_marker=True)
if self.with_mongo and self.base_mongo_cmd:
logging.debug('Setup Mongo')

View File

@ -242,6 +242,7 @@ sleep 3
/usr/local/hadoop/bin/hdfs dfs -mkdir /user/specuser
/usr/local/hadoop/bin/hdfs dfs -chown specuser /user/specuser
echo "chown_completed" | /usr/local/hadoop/bin/hdfs dfs -appendToFile - /preparations_done_marker
kdestroy