From 98bf8197ed8c8c8b13faefaa3b396b3d251cff2b Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 10 Jun 2023 20:00:36 +0200 Subject: [PATCH] remove running task folder after finishing task --- groupTasks/groups/production1/test1.py | 58 +++++++++++++------------- modules/grouptasks/grouptasks.go | 6 +++ 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/groupTasks/groups/production1/test1.py b/groupTasks/groups/production1/test1.py index 20f4c8b..8794d40 100644 --- a/groupTasks/groups/production1/test1.py +++ b/groupTasks/groups/production1/test1.py @@ -35,7 +35,7 @@ image_height = height * line_thickness # Hintergrundfarbe festlegen background_color = (255, 255, 255) # Weiß -for i in range(2): +for i in range(10): # Ein neues Bild erstellen image = Image.new("RGB", (image_width, image_height), background_color) @@ -55,48 +55,50 @@ for i in range(2): fill=color, width=line_thickness) # 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([ - # Vorderseite - [-1, -1, 1], - [1, -1, 1], - [1, 1, 1], - [-1, 1, 1], - # Rückseite - [-1, -1, -1], - [1, -1, -1], - [1, 1, -1], - [-1, 1, -1] + [0, 0, 0], + [width, 0, 0], + [width, height, 0], + [0, height, 0], + [0, 0, depth], + [width, 0, depth], + [width, height, depth], + [0, height, depth] ]) +# Flächen des Modells definieren faces = np.array([ - # Vorderseite [0, 1, 2], [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, 5, 4], + [0, 4, 5], + [0, 3, 7], + [0, 4, 7], + [1, 2, 6], + [1, 5, 6], [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 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 -cube_mesh.save('cube.stl') -print("Das 3D-Modell wurde erfolgreich als 'cube.stl' exportiert.") +rectangular_mesh.save('rectangular_model.stl') +print("Das 3D-Modell wurde erfolgreich als 'rectangular_model.stl' exportiert.") """ try: diff --git a/modules/grouptasks/grouptasks.go b/modules/grouptasks/grouptasks.go index a2b7391..a317a24 100644 --- a/modules/grouptasks/grouptasks.go +++ b/modules/grouptasks/grouptasks.go @@ -368,6 +368,12 @@ func RunGroupTask(args RunGroupTaskArgs) { Status: utils.GroupTasksStatusFinished, EndedAt: time.Now(), }) + + err = os.RemoveAll(runningTasksPath + groupTaskStep.GroupTasksId + "/") + + if err != nil { + log.Error().Msgf("Failed to delete running task folder %s", err.Error()) + } } }