How to use _path_join method in tox

Best Python code snippet using tox_python

daily_cook_t2_datasets.py

Source:daily_cook_t2_datasets.py Github

copy

Full Screen

...37 for result in results:38 print(u'---> Play book result <%s> DONE.' % result)39def run_phase_1_jobs(month):40 jobs = [41 (_path_join(u'dapp_youshu/cookbook/00_datakit_dataset_ele.yml'), month, u'ele_daily_env'),42 # (_path_join(u'dapp_youshu/cookbook/points_ranking_mt.yml'), month, u'mt_daily_env'),43 ]44 play_all_jobs(jobs)45 restart_workers()46 jobs = [47 # (_path_join(u'dapp_youshu/cookbook/00_datakit_dataset_ele.yml'), month, u'ele_daily_env'),48 (_path_join(u'dapp_youshu/cookbook/points_ranking_mt.yml'), month, u'mt_daily_env'),49 ]50 play_all_jobs(jobs)51def run_phase_2_jobs(month):52 jobs = [53 (_path_join(u'dapp_youshu/cookbook/salarykit_dataset_ele.yml'), month, u'ele_daily_env'),54 ]55 play_all_jobs(jobs)56 jobs = [57 (_path_join(u'dapp_youshu/cookbook/salarykit_dataset_mt.yml'), month, u'mt_daily_env'),58 ]59 play_all_jobs(jobs)60 restart_workers()61def run_pre_phase(month):62 biz = QPlusFinanceDatasetBiz.instance()63 biz.cook_finance_biz_dataset(month)64def run_qlife_worker_phase(month):65 biz = QPlusFinanceDatasetBiz.instance()66 biz.cook_qlife_workers_dataset(month)67def play_jobs(month=None, run_pre=True, run_x_1=True, run_x_2=True, run_x_3=False, run_x_4=True, run_x_5=False,68 run_x_worker=False, dask_address=None):69 if not month:70 month = int(datetime_util.prcnow().format('YYYYMM'))71 else:72 month = int(month)73 if dask_address:74 _dask_cfg['dask_address'] = dask_address75 if run_pre:76 run_pre_phase(month)77 if run_x_worker:78 run_qlife_worker_phase(month)79 restart_workers()80 if run_x_1:81 run_phase_1_jobs(month)82 restart_workers()83 if run_x_2:84 run_phase_2_jobs(month)85 restart_workers()86def run_month_phase_jobs(month):87 jobs = [88 (_path_join(u'dapp_youshu/cookbook/00_datakit_dataset_ele.yml'), month, u'ele_month_env'),89 (_path_join(u'dapp_youshu/cookbook/points_ranking_mt.yml'), month, u'mt_month_env'),90 ]91 play_all_jobs(jobs)92 restart_workers()93 jobs = [94 (_path_join(u'dapp_youshu/cookbook/salarykit_dataset_ele.yml'), month, u'ele_month_env'),95 (_path_join(u'dapp_youshu/cookbook/salarykit_dataset_mt.yml'), month, u'mt_month_env'),96 ]97 play_all_jobs(jobs)98 restart_workers()99def play_month_jobs(month=None, override_finance=False):100 if not month:101 month = int(datetime_util.prcnow().format('YYYYMM'))102 else:103 month = int(month)104 restart_workers()105 run_month_phase_jobs(month)106# def play_act_jobs(month):107# month = int(month)108#109# biz = SalaryFlowBiz.instance()110# biz.cook_salaryflow_month_dataset(month)111#112# restart_workers()113# jobs = [114# (_path_join(u'dapp_youshu/cookbook/adjust_data_with_new_finacial_ele.yml'), month, u'ele_month_env'),115# (_path_join(u'dapp_youshu/cookbook/adjust_data_with_new_finacial_mt.yml'), month, u'mt_month_env'),116# ]117# play_all_jobs(jobs)118# # restart_workers()119# # run_phase_4_jobs(month)120# # restart_workers()121# jobs2 = [122# # (_path_join(u'dapp_youshu/cookbook/financial_to_compass_comparison.yml'), month, None),123# (_path_join(u'dapp_youshu/cookbook/city_order_cost_actual_mt_ele.yml'), month, None),124# (_path_join(u'dapp_youshu/cookbook/dc_order_cost_actual_mt_ele.yml'), month, None)125# ]126# play_all_jobs(jobs2)127# restart_workers()128def play_worker_salarysheet_jobs(month, t2=True, update_worker_alive_tags=False):129 """更新一线花名册130 :param month:131 :type month:132 :param t2:133 :type t2:134 :return:135 :rtype:136 """137 biz = SalarySheetBiz.instance()138 biz.build_ele_worker_salary_sheet_data(month, './datastore/salary/data', t2_mode=True)139 biz.build_mt_worker_salary_sheet_data(month, './datastore/salary/data', t2_mode=t2)140 if update_worker_alive_tags:141 biz.update_worker_alive_tags(month, t2_mode=True)142 biz.update_worker_alive_tags(month, t2_mode=False)143def play_recommend_jobs(month, dump_dir='./'):144 """145 执行内荐费任务,将数据给到汇流146 :param month:147 :return:148 """149 # 1、create salarysheet dataset to s3150 month = int(month)151 biz = SalarySheetBiz.instance()152 biz.cook_salarysheet_month_dataset(month)153 # 2、play recommend yml154 restart_workers()155 jobs = [156 (_path_join(u'dapp_youshu/cookbook/mt_recommend_bonus_details.yml'), month, u'mt_daily_env'),157 ]158 play_book(jobs[0])159 restart_workers()160 # 3、load s3 recommend dataset dump to excel161 biz = StdDatasetBiz.instance()162 biz.dump_huiliu_recommend_file(month, u'mt_recommend_bonus_details', dump_dir)163def play_qlife_worker_jobs(month, with_month_data=False):164 biz = QLifeWorkerProfileChecker().instance()165 biz.check_ele_pending_records(month)166 biz.validate_ele_worker_profile(month)167 biz.check_mt_pending_records(month, with_month_data)168 biz.validate_mt_worker_profile(month)169 biz.book_ok_records(month)170def play_new_compass(current_month, last_month, day):171 restart_workers()172 jobs = [173 (_path_join(u'dapp_youshu/cookbook/new_compass/process_middle_table_ele.yml'), current_month, u'ele_daily_env'),174 # (_path_join(u'dapp_youshu/cookbook/new_compass/transfer_month_city_analysis_ele.yml'), last_month,175 # u'ele_month_env'),176 (_path_join(u'dapp_youshu/cookbook/new_compass/process_middle_table_mt.yml'), current_month, u'mt_daily_env'),177 (_path_join(u'dapp_youshu/cookbook/new_compass/process_middle_table_yk.yml'), current_month, u'yk_daily_env'),178 ]179 if 1 <= day <= 10:180 jobs.append(181 (_path_join(u'dapp_youshu/cookbook/new_compass/process_middle_table_ele.yml'), last_month, u'ele_month_env')182 )183 jobs.append(184 (_path_join(u'dapp_youshu/cookbook/new_compass/process_middle_table_mt.yml'), last_month, u'mt_month_env')185 )186 jobs.append(187 (_path_join(u'dapp_youshu/cookbook/new_compass/process_middle_table_yk.yml'), last_month, u'yk_month_env')188 )189 for job in jobs:190 play_book(job)191def play_mt_reports(current_month):192 jobs = [193 (_path_join(u'dapp_youshu/cookbook/final_accounts_report_form_mt.yml'), current_month,194 'mt_report_from_final_accounts_daily_env')195 ]196 for job in jobs:197 play_book(job)198def play_finance_week_reports(current_month):199 jobs = [200 (_path_join(u'dapp_youshu/cookbook/finance-week/finance_weekly_report_dataset.yml'), current_month, u'new_finance_weekly_report_env'),201 (_path_join(u'dapp_youshu/cookbook/finance-week/finance_weekly_financial_report_dataset.yml'), current_month, u'new_financial_form_snap_env'),202 ]203 for job in jobs:204 play_book(job)205def cron_daily(cook_first_day=2, cook_last_month_day=10, cook_month_jobs_day=(1, 10)):206 """每日定时任务, copied from datahub_job/compass_cooker.py207 :return:208 :rtype:209 """210 today = datetime_util.prcnow()211 currentday = today.datetime.day212 current_month = int(today.format('YYYYMM'))213 print(u'==== cron_daily START ===')214 if currentday > cook_first_day:215 try:...

Full Screen

Full Screen

build_armada.py

Source:build_armada.py Github

copy

Full Screen

...77def _create_env(options, version):78 tmp_dir = mkdtemp(prefix='armada_package')79 _create_package_dirs(options, tmp_dir)80 for bin in options['binaries']:81 dest = _path_join(tmp_dir, options['binaries_path'], bin)82 shutil.copy2(_path_join(options['binaries_src'], bin), dest)83 os.chmod(dest, 0o755)84 shutil.copy2(_path_join(options['docker_compatibility_src']),85 _path_join(tmp_dir, options['docker_compatibility_path']))86 shutil.copy2(_path_join(options['autocomplete_src']),87 _path_join(tmp_dir, options['autocomplete_path']))88 shutil.copy2(_path_join(options['armada_command_requirements_src']),89 _path_join(tmp_dir, options['armada_command_requirements_file_path']))90 shutil.copy2(_path_join(options['default_file_src']), _path_join(tmp_dir, options['default_file_path']))91 shutil.copy2(_path_join(options['initd_script_src']), _path_join(tmp_dir, options['initd_script_file_path']))92 shutil.copy2(_path_join(options['systemd_file_src']), _path_join(tmp_dir, options['systemd_service_file_path']))93 with open(_path_join(tmp_dir, '/opt/armada', 'version'), 'wt') as f:94 f.write('ARMADA_VERSION={}'.format(version))95 return tmp_dir96def _cleanup_dist():97 shutil.rmtree('./dist', ignore_errors=True)98 os.mkdir('./dist')99def _path_join(*args):100 # if os.path.join detect that component is an absolute path, it thrown away previous ones101 return path.normpath('/'.join(args))102def _create_package_dirs(options, tmp_dir):103 for key, value in options.items():104 if not isinstance(key, str) or not key.endswith('path'):105 continue106 base_dir = path.dirname(value)107 os.makedirs(_path_join(tmp_dir, base_dir), exist_ok=True)108def _create_package(options, version):109 packege_root = _create_env(defaults, version)110 fpm_options = [111 "fpm",112 "-t", options['package_type'],113 "-s", "dir",114 "--description", "armada",115 "-C", packege_root,116 "--license", "\"Apache 2.0\"",117 "--maintainer", "cerebro@ganymede.eu",118 "--url", "armada.sh",119 "--config-files", options['default_file_path'],120 "--after-install", options['postinst_src'],121 "--name", options['name'],...

Full Screen

Full Screen

resource.py

Source:resource.py Github

copy

Full Screen

...20 def get_data_dir(self):21 return self._data_dir22 @property23 def get_model_dir(self):24 return self._path_join(self._model_dir)25 @property26 def get_log_dir(self):27 return self._path_join(self._log_dir)28 @property29 def get_original_dir(self):30 return self._path_join(self._original_dir)31 @property32 def get_prepared_dir(self):33 return self._path_join(self._prepared_dir)34 @property35 def get_test_dir(self):36 return self._path_join(self._test_dir)37 @property38 def get_result_dir(self):39 return self._path_join(self._result_dir)40 def _path_join(self, dir):41 if isinstance(dir, list):42 return [os.path.join(self.get_data_dir, d) for d in dir]43 return os.path.join(self.get_data_dir, dir)44 def _make_dir(self, dir):45 if isinstance(dir, list):46 for d in dir:47 if not os.path.exists(d):48 os.makedirs(d)49 else:50 if not os.path.exists(dir):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful