@@ -0,0 +1,1123 @@
+import os%0Aimport sys%0Afrom datetime import datetime, timedelta%0Afrom time import sleep%0A%0Aimport tensorflow as tf%0A%0A%0Adef check_file_exist_infinity(input_file):%0A    while True:%0A        if tf.io.gfile.exists(input_file):%0A            break%0A        print('%7B%7D does not exist, sleep 10s...'.format(input_file))%0A        sleep(10)%0A    print('%7B%7D is ok'.format(input_file))%0A%0A%0Adef main():%0A    input_dir = os.getenv('INPUT_PATH')%0A    has_date = os.getenv('HAS_DATE', 0)%0A    offset = os.getenv('OFFSET')%0A    check_success = int(os.getenv('CHECK_SUCCESS', '1'))%0A    if not input_dir:%0A        print(%22Input dir is not set%22)%0A        sys.exit(1)%0A%0A    if has_date:%0A        cur_day = datetime.today()%0A        if offset and int(offset) %3E 0:%0A            offset = int(offset)%0A        else:%0A            offset = 1  # default last day%0A        cur_day = cur_day - timedelta(days=offset)%0A        cur_day_str = cur_day.strftime('%25Y%25m%25d')%0A        input_dir = os.path.join(input_dir, cur_day_str)%0A%0A    if check_success:%0A        input_dir = os.path.join(input_dir, '_SUCCESS')%0A%0A    check_file_exist_infinity(input_dir)%0A%0A%0Aif __name__ == %22__main__%22:%0A    main()%0A

add data sensor script (#1026)