Skip to content

Commit 220ff1b

Browse files
authored
Workflow changes (#24)
* Added new fields in workflow * Add objects to script task * Add example workflow with run of one test * Update visualizer to handle new fileds * Style changes * Formatter * Small refactor, add doc strings * Fix circular import * Remove old example workflow * Run isort * Fix typos, remove unnecessary code * Start of workflow creation * Working outgen graph creation * Inwer * Running * User out workflow * Test run * Run formatters * Add compilation to workflows * Add more examples * Add proper limits handling * Run formatters * Fix tests * Refactor * Reformat
1 parent 4075a76 commit 220ff1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4808
-1155
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ pip install sio3pack
2222
# Package unpacking
2323
import sio3pack, sio3workers
2424
from django.conf import settings
25+
2526
package = sio3pack.from_file(path_to_package, django_settings=settings)
26-
graph_op: GraphOperation = package.get_unpack_graph()
27+
graph_op: GraphOperation = package.get_unpack_operation()
2728
results = sioworkers.run(graph_op)
2829
graph_op.return_results(results)
2930
package.save_to_db(problem_id=1)
@@ -33,8 +34,9 @@ package.save_to_db(problem_id=1)
3334

3435
```python
3536
import sio3pack, sio3workers.local
37+
3638
package = sio3pack.from_file(path_to_package)
37-
graph_op: GraphOperation = package.get_unpack_graph()
39+
graph_op: GraphOperation = package.get_unpack_operation()
3840
results = sio3workers.local.run(graph_op)
3941
graph_op.return_results(results)
4042
```

example_workflows/example.json

Lines changed: 120 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,122 @@
11
{
2-
"name": "Example workflow",
3-
"external_objects" : [
4-
"example-object"
5-
],
6-
"observable_objects" : [],
7-
"observable_registers" : 1,
8-
"registers" : 3,
9-
"tasks" : [
10-
{
11-
"name": "Example script",
12-
"input_registers" : [
13-
1
14-
],
15-
"output_registers" : [
16-
0,
17-
2
18-
],
19-
"reactive" : true,
20-
"script" : "<PLACEHOLDER>",
21-
"type" : "script"
22-
},
23-
{
24-
"name": "Example execution",
25-
"exclusive" : true,
26-
"filesystems" : [
27-
{
28-
"image" : "example-image",
29-
"path" : "",
30-
"type" : "image"
31-
},
32-
{
33-
"type" : "empty"
34-
},
35-
{
36-
"handle" : "example-object",
37-
"type" : "object"
38-
}
39-
],
40-
"hard_time_limit" : 2137,
41-
"mount_namespaces" : [
42-
{
43-
"mountpoints" : [
44-
{
45-
"source" : 1,
46-
"target" : "/exe",
47-
"writable" : false
48-
}
49-
],
50-
"root" : 0
51-
}
52-
],
53-
"output_register" : 1,
54-
"pid_namespaces" : 1,
55-
"pipes" : [
56-
{
57-
"buffer_size" : 1048576,
58-
"file_buffer_size" : 1073741824,
59-
"limit" : 2147483648
60-
}
61-
],
62-
"processes" : [
63-
{
64-
"arguments" : [
65-
"/exe",
66-
"--help"
67-
],
68-
"environment" : [
69-
"TERM=xterm-256color"
70-
],
71-
"image" : "/exe",
72-
"mount_namespace" : 0,
73-
"pid_namespace" : 0,
74-
"resource_group" : 0,
75-
"working_directory" : "/"
76-
}
77-
],
78-
"resource_groups" : [
79-
{
80-
"cpu_usage_limit" : 21.37,
81-
"instruction_limit" : 2137000000,
82-
"memory_limit" : 2147483648,
83-
"oom_terminate_all_tasks" : false,
84-
"pid_limit" : 8,
85-
"swap_limit" : 4,
86-
"time_limit" : 2137000000
87-
}
88-
],
89-
"system_pipes" : 3,
90-
"type" : "execution"
91-
}
92-
]
2+
"name": "Example workflow",
3+
"external_objects": [
4+
"example-object"
5+
],
6+
"observable_objects": [],
7+
"observable_registers": 1,
8+
"registers": 3,
9+
"tasks": [
10+
{
11+
"type": "script",
12+
"name": "example_script",
13+
"input_registers": [
14+
1
15+
],
16+
"output_registers": [
17+
0,
18+
2
19+
],
20+
"reactive": true,
21+
"script": "<PLACEHOLDER>"
22+
},
23+
{
24+
"type": "execution",
25+
"name": "example_execution",
26+
"channels": [
27+
{
28+
"buffer_size": 1048576,
29+
"file_buffer_size": 1073741824,
30+
"limit": 2147483648,
31+
"source_pipe": 0,
32+
"target_pipe": 1
33+
}
34+
],
35+
"exclusive": true,
36+
"filesystems": [
37+
{
38+
"type": "image",
39+
"image": "example-image",
40+
"path": ""
41+
},
42+
{
43+
"type": "empty"
44+
},
45+
{
46+
"type": "object",
47+
"handle": "example-object"
48+
}
49+
],
50+
"hard_time_limit": 2137,
51+
"mount_namespaces": [
52+
{
53+
"root": 0,
54+
"mountpoints": [
55+
{
56+
"source": 1,
57+
"target": "/exe",
58+
"writable": false
59+
}
60+
]
61+
}
62+
],
63+
"output_register": 1,
64+
"pid_namespaces": 1,
65+
"pipes": 3,
66+
"processes": [
67+
{
68+
"arguments": [
69+
"/exe",
70+
"--help"
71+
],
72+
"descriptors": {
73+
"0": {
74+
"type": "object_read",
75+
"handle": "stdin"
76+
},
77+
"1": {
78+
"type": "object_write",
79+
"handle": "stdout"
80+
},
81+
"2": {
82+
"type": "null"
83+
},
84+
"3": {
85+
"type": "pipe_write",
86+
"pipe": 0
87+
},
88+
"4": {
89+
"type": "pipe_read",
90+
"pipe": 1
91+
},
92+
"65534": {
93+
"type": "file",
94+
"filesystem": 0,
95+
"path": "/etc/hosts",
96+
"mode": "read"
97+
}
98+
},
99+
"environment": [
100+
"TERM=xterm-256color"
101+
],
102+
"image": "/exe",
103+
"mount_namespace": 0,
104+
"pid_namespace": 0,
105+
"resource_group": 0,
106+
"working_directory": "/"
107+
}
108+
],
109+
"resource_groups": [
110+
{
111+
"cpu_usage_limit": 21.37,
112+
"instruction_limit": 2137000000,
113+
"memory_limit": 2147483648,
114+
"oom_terminate_all_tasks": false,
115+
"pid_limit": 8,
116+
"swap_limit": 4,
117+
"time_limit": 2137000000
118+
}
119+
]
120+
}
121+
]
93122
}

0 commit comments

Comments
 (0)