python) metaflow 파이썬 스크립트에서 실행해보기

2023. 2. 10. 20:18분석 Python/구현 및 자료

728x90

metaflow를 이용해서 python script를 실행하는 방법에 대해서 공유

subprocess를 실행하고, 대기 상태를 건 다음에 다음 flow를 실행하게 해 봤다.

 

    import subprocess
    import time
    print("first")
    p = subprocess.Popen(['python', './metaflow/tutorials/02-statistics/stats.py','run'])
    while p.poll() is None:
        print('.', end='', flush=True)
        time.sleep(1)
    print('returncode', p.returncode)
    print("second")
    p = subprocess.Popen(['python', './metaflow/tutorials/02-statistics/stats.py','run'])
    while p.poll() is None:
        print('.', end='', flush=True)
        time.sleep(1)
    print('returncode', p.returncode)

 

가장 간단한 방법은 다음과 같다.

flow 간의 완료 여부를 체크하는 코드도 필요해 보인다.

 

728x90