Open jiminchur opened 6 months ago
[3/13] 코디 파이프라인 설계 시작
코드가 잘 돌아가는지 확인하기 위해 일단 파일을 생성하였으나 생성이 되지 않음
필요한 코드 아래와 같이 추가
# DAG 설정
dag = DAG(
dag_id='cody_test1',
schedule_interval=None,
start_date=datetime.now(),
# PythonOperator를 사용하여 함수 실행
cody_test_DB = PythonOperator(task_id='extract_existing_cody_ids',
python_callable=extract_existing_cody_ids,
dag=dag
)
[3/14]
[2024-03-14 13:59:29,791] {selenium_manager.py:149} WARNING - The chromedriver version (114.0.5735.90) detected in PATH at /usr/bin/chromedriver might not be compatible with the detected chrome version (122.0.6261.111); currently, chromedriver 122.0.6261.128 is recommended for chrome 122.*, so it is advised to delete the driver in PATH and retry
[2024-03-14 13:59:31,349] {taskinstance.py:1396} ERROR - Message: unknown error: Chrome failed to start: crashed.
driver = webdriver.Chrome(service=Service(ChromeDriverManager(driver_version="122.0.6261.94").install()), options=options)
cody_test3 Dag 생성
: 크롤링해 온 데이터 XCom에 저장까지 성공
[3/15]
[3/16]
db에 데이터가 들어갔는데 몇개가 안 들어감
for i in range(start_index, end_index + 1):
try:
brand_text = driver.find_element(By.CSS_SELECTOR, f"#style_info > div.styling_goods > div.gender-classification > div > div > div.styling_list.swiper-wrapper > div:nth-child({i}) > a.brand_item").text
cody_dic[f'item{i}'] = brand_text
except NoSuchElementException:
cody_dic[f'item{i}'] = None # 해당 CSS 선택자가 없으면 Null 값으로 설정
try: option_text = driver.find_element(By.CSS_SELECTOR, f"#style_info > div.styling_goods > div.gender-classification > div > div > div.styling_list.swiper-wrapper > div:nth-child({i}) > span.option").text cody_dic[f'item_size{i}'] = option_text except NoSuchElementException: cody_dic[f'item_size{i}'] = None # 해당 CSS 선택자가 없으면 Null 값으로 설정
- 해결완료
[3/18]
-> 코디 파이프라인 완성
Cody Pipeline