def load_executor_page(self): ''' Method to click on executor link and go to executor page :return: ''' Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.executor_link) Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.executor_header)
def load_storage_page(self): ''' Method to click on storage link and go to storage page :return: ''' Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.storage_link) Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.storage_header)
def load_jobs_page(self): ''' Method to click on Jobs link and go to Jobs page :return: ''' Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.job_link) Selenium.waitTillElementBecomesVisible(driver=self.driver, xpath=SPARK_XPATH.job_header)
def go_to_incomplete_app(self): ''' Method to navigate to incomplete apps page :return: ''' Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.incomplete_app_link) Selenium.click_on_element_xpath(driver=self.driver, xpath=SPARK_XPATH.incomplete_app_link)
def download_logs(self, app_id): [ os.remove(os.path.join("/tmp/", f)) for f in os.listdir("/tmp/") if f.startswith("eventLogs-") ] Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.log_download.format(app_id), maxWait=max_wait) Selenium.click_on_element_xpath( driver=self.driver, xpath=SPARK_XPATH.log_download.format(app_id)) from glob import glob result = glob('/tmp/eventLogs-{0}*.zip'.format(app_id)) sleep_time = 0 while len(result) <= 0 and sleep_time <= 10: time.sleep(1) sleep_time = sleep_time + 1 result = glob('/tmp/eventLogs-{0}*.zip'.format(app_id)) return len(result) > 0
def click_on_app(self, app_id): ''' Method to click on the spark app based on app id :param app_id: :return: ''' is_app_visible = Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.app_id.format(app_id), maxWait=max_wait) if not is_app_visible: self.driver.refresh() Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.app_id.format(app_id), maxWait=max_wait) Selenium.click_on_element_xpath(self.driver, SPARK_XPATH.app_id.format(app_id)) Selenium.waitTillElementBecomesVisible(driver=self.driver, xpath=SPARK_XPATH.job_header)
def go_to_completed_app(self): Selenium.waitTillElementBecomesVisible( driver=self.driver, xpath=SPARK_XPATH.completed_app_link) Selenium.click_on_element_xpath(driver=self.driver, xpath=SPARK_XPATH.completed_app_link)