remove running task folder after finishing task

main
alex 2023-06-10 20:00:36 +02:00
parent fcf6625137
commit 98bf8197ed
2 changed files with 36 additions and 28 deletions

View File

@ -35,7 +35,7 @@ image_height = height * line_thickness
# Hintergrundfarbe festlegen # Hintergrundfarbe festlegen
background_color = (255, 255, 255) # Weiß background_color = (255, 255, 255) # Weiß
for i in range(2): for i in range(10):
# Ein neues Bild erstellen # Ein neues Bild erstellen
image = Image.new("RGB", (image_width, image_height), background_color) image = Image.new("RGB", (image_width, image_height), background_color)
@ -55,48 +55,50 @@ for i in range(2):
fill=color, width=line_thickness) fill=color, width=line_thickness)
# Bild als Datei speichern # Bild als Datei speichern
image.save("generiertes_bild"+str(i)+".png") image.save("generiertes_bild"+str(i)+".jpg")
# Erstellen eines einfachen Würfelmodells # Abmessungen des rechteckigen Modells
width = 196
height = 196
depth = 26
# Eckpunkte des Modells erstellen
vertices = np.array([ vertices = np.array([
# Vorderseite [0, 0, 0],
[-1, -1, 1], [width, 0, 0],
[1, -1, 1], [width, height, 0],
[1, 1, 1], [0, height, 0],
[-1, 1, 1], [0, 0, depth],
# Rückseite [width, 0, depth],
[-1, -1, -1], [width, height, depth],
[1, -1, -1], [0, height, depth]
[1, 1, -1],
[-1, 1, -1]
]) ])
# Flächen des Modells definieren
faces = np.array([ faces = np.array([
# Vorderseite
[0, 1, 2], [0, 1, 2],
[0, 2, 3], [0, 2, 3],
# Rückseite
[4, 5, 6],
[4, 6, 7],
# Seiten
[0, 4, 7],
[0, 7, 3],
[1, 5, 6],
[1, 6, 2],
[0, 1, 5], [0, 1, 5],
[0, 5, 4], [0, 4, 5],
[0, 3, 7],
[0, 4, 7],
[1, 2, 6],
[1, 5, 6],
[2, 3, 7], [2, 3, 7],
[2, 7, 6] [2, 6, 7],
[4, 5, 6],
[4, 6, 7]
]) ])
cube_mesh = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype)) # Erstellen des Modells mit den Eckpunkten und Flächen
rectangular_mesh = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype))
for i, face in enumerate(faces): for i, face in enumerate(faces):
for j, vertex_id in enumerate(face): for j, vertex_id in enumerate(face):
cube_mesh.vectors[i][j] = vertices[vertex_id] rectangular_mesh.vectors[i][j] = vertices[vertex_id]
# Exportieren des Modells als .stl-Datei # Exportieren des Modells als .stl-Datei
cube_mesh.save('cube.stl') rectangular_mesh.save('rectangular_model.stl')
print("Das 3D-Modell wurde erfolgreich als 'cube.stl' exportiert.") print("Das 3D-Modell wurde erfolgreich als 'rectangular_model.stl' exportiert.")
""" """
try: try:

View File

@ -368,6 +368,12 @@ func RunGroupTask(args RunGroupTaskArgs) {
Status: utils.GroupTasksStatusFinished, Status: utils.GroupTasksStatusFinished,
EndedAt: time.Now(), EndedAt: time.Now(),
}) })
err = os.RemoveAll(runningTasksPath + groupTaskStep.GroupTasksId + "/")
if err != nil {
log.Error().Msgf("Failed to delete running task folder %s", err.Error())
}
} }
} }