You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fractale/agent/kubernetes/job/prompts.py
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
importjson
2
+
1
3
importfractale.agent.defaultsasdefaults
2
4
fromfractale.agent.promptsimportprompt_wrapper
3
5
@@ -29,6 +31,46 @@
29
31
%s
30
32
"""
31
33
34
+
update_prompt="""You are a Kubernetes Job update agent. Your job is to take a spec of updates for a Job Manifest and apply them.
35
+
You are NOT allowed to make other changes to the manifest. Ignore the 'decision' field and if you think appropriate, add context from "reason" as comments.
36
+
Here are the updates:
37
+
38
+
%s
39
+
40
+
And here is the Job manifest to apply them to:
41
+
%s
42
+
Return ONLY the YAML with no other text or commentary.
43
+
"""
44
+
45
+
46
+
defget_optimize_prompt(context, resources):
47
+
"""
48
+
Get a description of cluster resources and optimization goals.
49
+
"""
50
+
prompt="""
51
+
Your task is to optimize the running of a Kubernetes Job: %s in %s. You are allowed to request anywhere in the range of available resources, including count and type. Here are the available resources:
52
+
%s
53
+
Here is the current job manifest:
54
+
```yaml
55
+
%s
56
+
```
57
+
Please return ONLY a json structure to be loaded that includes a limited set of fields (with keys corresponding to the names that are organized the same as a Kubernetes Job, e.g., spec -> template -spec.
58
+
The result should be provided as json. The fields should map 1:1 into a pod spec serialzied as json.
59
+
Do not make requests that lead to Guaranteed pods. DO NOT CHANGE PROBLEM SIZE PARAMETERS OR COMMAND. You can change args. Remember that
60
+
to get a full node resources you often have to ask for slightly less than what is available.
61
+
"""% (
62
+
context.optimize,
63
+
context.environment,
64
+
json.dumps(resources),
65
+
context.result,
66
+
)
67
+
dockerfile=context.get("dockerfile")
68
+
ifdockerfile:
69
+
prompt+= (
70
+
f" Here is the Dockerfile that helped to generate the application.\n{dockerfile}\n"
0 commit comments