File size: 1,703 Bytes
62f41f9
 
 
 
 
 
 
 
be5d475
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea540bb
 
 
 
be5d475
62f41f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os, random
from logging import getLogger, StreamHandler, DEBUG
logger = getLogger(__name__)
handler = StreamHandler(); handler.setLevel(DEBUG)
logger.setLevel(DEBUG)
logger.addHandler(handler)
logger.propagate = False


def get_random_name():
    famous_painters = [
    "Leonardo", "DaVinci",
    "Michelangelo",
    "Pablo", "Picasso",
    "Vincent", "VanGogh",
    "Rembrandt", "VanRijn",
    "Claude", "Monet",
    "Salvador", "Dali",
    "Jackson", "Pollock",
    "Andy", "Warhol",
    "Henri", "Matisse",
    "Georgia", "Keeffe",
    "Edvard", "Munch",
    "Wassily", "Kandinsky",
    "Gustav", "Klimt",
    "Rene", "Magritte",
    "Frida", "Kahlo",
    "Edgar", "Degas",
    "Johannes", "Vermeer",
    "Paul", "Cezanne",
    "Marc", "Chagall",
    ]

    random_painter = random.choice(famous_painters)

    # 4桁の乱数を生成
    rand_num = random.randint(1000, 9999)

    return random_painter+str(rand_num)


def complete(work_dir):
    work_dir = work_dir
    # logger.debug(f"complete :", work_dir)
    return work_dir


def clean(text_output):
    # logger.debug(f"text_output : {text_output}")

    if text_output!="idle_state":
        logger.info(f"clean up : {text_output}.zip")
        os.remove(f"{text_output}.zip")
        return "idle_state"
    else:
        logger.info(f"reset")
        return "idle_state"



def clean_by_name(text_output):
    # logger.debug(f"text_output : {text_output}")
    if text_output!="idle_state":
        text_output, dir_name = text_output.split("+")
        logger.info(f"clean up : {dir_name}.zip")
        os.remove(f"{dir_name}.zip")
        return "idle_state"
    else:
        logger.info(f"reset")
        return "idle_state"