-
Notifications
You must be signed in to change notification settings - Fork 83
Added cluster resource attribute support #65
Added cluster resource attribute support #65
Conversation
60a8ba2
to
ea6b40e
Compare
Signed-off-by: Prafulla Mahindrakar <[email protected]>
0d6eca9
to
28f0bfd
Compare
Codecov Report
@@ Coverage Diff @@
## master #65 +/- ##
==========================================
+ Coverage 55.67% 57.94% +2.27%
==========================================
Files 58 68 +10
Lines 1455 1548 +93
==========================================
+ Hits 810 897 +87
- Misses 590 596 +6
Partials 55 55
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Signed-off-by: Prafulla Mahindrakar <[email protected]>
1f67ba2
to
c4a6262
Compare
Signed-off-by: Prafulla Mahindrakar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a link to the documentation https://docs.flyte.org/en/latest/howto/managing_customizable_resources.html#cluster-resources in the command Usage blocks?
if err != nil { | ||
return err | ||
} | ||
// Update the shadow config with the fetched taskResourceAttribute which can then be written to a file which can then be called for an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry not quite following - why do you undecorate in this call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shadow config of TaskResourceAttrFileConfig contains taskResourceAttributes and not the decorated matchable attribute.
type TaskResourceAttrFileConfig struct {
Project string `json:"project"`
Domain string `json:"domain"`
Workflow string `json:"workflow,omitempty"`
*admin.TaskResourceAttributes
}
This i decided to do , inorder to not have the config file like this.
domain: development
project: flytectldemo
matching_attributes:
Target:
taskResourceAttributes:
defaults:
cpu: "1"
memory: 150Mi
limits:
cpu: "2"
memory: 350Mi
And Instead have it like this
domain: development
project: flytectldemo
defaults:
cpu: "1"
memory: 150Mi
limits:
cpu: "2"
memory: 350Mi
Now when fetching from the admin we get MatchableAttribute in ProjectDomainAttribute/Workflowattribute
but which one to undecorate depends on what was the resource type passed in the call
And depending on that
The corr. config undecorate would call.
matchingAttribute.GetTaskResourceAttributes()
Or
matchingAttribute.GetClusterResourceAttributes()
This also avoids different structure of ProjectDomainAttributes / WorkflowAttributes as the same struct TaskResourceAttrFileConfig eg . can now be used as both contain TaskResourceAttributes
Let me know what you think
|
||
Updating to the cluster resource attribute is only available from a generated file. See the get section for generating this file. | ||
Here the command updates takes the input for cluster resource attributes from the config file cra.yaml | ||
eg: content of tra.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eg: content of tra.yaml | |
eg: content of cra.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
flytectl update cluster-resource-attribute -attrFile cra.yaml | ||
|
||
Updating cluster resource attribute for project and domain and workflow combination. This will take precedence over any other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be nice to call it that will completely overwrite any existing custom project and domain and workflow combination attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure . Let me add this in my followup MR of execution atrributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this.
Also this will completely overwrite any existing custom project and domain and workflow combination attributes. Would be preferable to do get and generate an attribute file if there is an existing attribute already set and then update it to have new values
Yeah makes sense |
Signed-off-by: Prafulla Mahindrakar [email protected]
TL;DR
This PR specifically addresses supporting cluster resource attributes through flytectl.
Retrieves cluster resource attributes for given project,domain combination or additionally with workflow name.
Here the command get cluster resource attributes for project flytectldemo and development domain.
flytectl get cluster-resource-attribute -p flytectldemo -d development
eg : O/P
Writing the cluster resource attribute to a file. If there are no cluster resource attributes , command would return an error
Here the command gets cluster resource attributes and writes the config file to tra.yaml
eg: content of tra.yaml
flytectl get cluster-resource-attribute --attrFile cra.yaml
Updates cluster resource attributes for given project and domain combination or additionally with workflow name.
Updating the cluster resource attribute is only available from config file
Here the command updates takes the input for cluster resource attributes from the config file cra.yaml
eg: content of tra.yaml
flytectl update cluster-resource-attribute -attrFile cra.yaml
Deletes cluster resource attributes for given project and domain combination or additionally with workflow name.
Deletes cluster resource attribute for project and domain
Here the command delete cluster resource attributes for project flytectldemo and development domain.
flytectl delete cluster-resource-attribute -p flytectldemo -d development
Deleting cluster resource attribute using config file
Here the command deletes cluster resource attributes from the config file cra.yaml
eg: content of cra.yaml which will use the project domain and workflow name for deleting the resource
flytectl delete cluster-resource-attribute --attrFile cra.yaml
Deleting cluster resource attribute for a workflow
Here the command deletes cluster resource attributes for a workflow
flytectl delete cluster-resource-attribute -p flytectldemo -d development core.control_flow.run_merge_sort.merge_sort
Type
Are all requirements met?
Complete description
Tracking Issue
flyteorg/flyte#992
Follow-up issue
NA