Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Added support for execution queue attribute #66

Merged

Conversation

pmahindrakar-oss
Copy link
Contributor

@pmahindrakar-oss pmahindrakar-oss commented May 12, 2021

Signed-off-by: Prafulla Mahindrakar [email protected]

TL;DR

This PR specifically addresses supporting execution queue attributes through flytectl.

  • GET

Retrieves execution queue attributes for given project,domain combination or additionally with workflow name.

Here the command get execution queue attributes for project flytectldemo and development domain.

flytectl get execution-queue-attribute -p flytectldemo -d development

eg : O/P

{"project":"flytectldemo","domain":"development","tags":["buzz","lightyear","foo","bar"]}

Writing the execution queue attribute to a file. If there are no execution queue attributes , command would return an error
Here the command gets exectuin queue attributes and writes the config file to era.yaml
eg: content of tra.yaml

flytectl get execution-queue-attribute --attrFile era.yaml

.. code-block:: yaml

	domain: development
	project: flytectldemo
	tags:
	  - foo
	  - buzz
	  - lightyear
  • UPDATE
    Updates execution queue attributes for given project and domain combination or additionally with workflow name.

Updating the execution queue attribute is only available from config file
Here the command updates takes the input for execution queue attributes from the config file era.yaml

eg: content of era.yaml
flytectl update execution-queue-attribute -attrFile era.yaml

  • DELETE
    Deletes execution queue attributes for given project and domain combination or additionally with workflow name.
    Deletes execution queue attribute for project and domain
    Here the command delete execution queue attributes for project flytectldemo and development domain.

flytectl delete execution-queue-attribute -p flytectldemo -d development

Deleting execution queue attribute using config file
Here the command deletes execution queue attributes from the config file era.yaml
eg: content of era.yaml which will use the project domain and workflow name for deleting the resource

flytectl delete execution-queue-attribute --attrFile era.yaml

.. code-block:: yaml

	domain: development
	project: flytectldemo
	tags:
	  - foo
	  - buzz
	  - lightyear

Deleting execution queue attribute for a workflow
Here the command deletes execution queue attributes for a workflow

flytectl delete execution-attribute -p flytectldemo -d development core.control_flow.run_merge_sort.merge_sort

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

Tracking Issue

flyteorg/flyte#992

Follow-up issue

NA

@pmahindrakar-oss pmahindrakar-oss force-pushed the pmahindrakar/matchable-execution-queue-attributes branch from 34f46fe to 0f2030b Compare May 12, 2021 14:00
@pmahindrakar-oss pmahindrakar-oss requested a review from katrogan May 12, 2021 14:29
katrogan
katrogan previously approved these changes May 12, 2021

// UnDecorate to uncover ExecutionQueueAttributes.
func (a *AttrFileConfig) UnDecorate(matchingAttribute *admin.MatchingAttributes) {
if matchingAttribute == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when does this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will happen in case where admin doesn't return an error of empty matching attribute and we try to unwrap the response to get the executionQueueAttribute which wont exist.
This is check is safeguard against it.

This is what is passed to undecorate
workflowAttr.GetAttributes().GetMatchingAttributes()
Where workflowAttr is response from the admin

Ideally it would be preferable to do null checks for both workflowAttr.GetAttributes() and then workflowAttr.GetAttributes().GetMatchingAttributes()

Since the idl can return nil for both


func (m *WorkflowAttributesGetResponse) GetAttributes() *WorkflowAttributes {
	if m != nil {
		return m.Attributes
	}
	return nil
}

...

func (m *WorkflowAttributes) GetMatchingAttributes() *MatchingAttributes {
	if m != nil {
		return m.MatchingAttributes
	}
	return nil
}```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh interesting, so there are cases where we don't return not found but just an empty response? that seems wrong

Copy link
Contributor Author

@pmahindrakar-oss pmahindrakar-oss May 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be avoiding this in code path, but the idl supports returning nil hence added a guard .
I haven't seen it during my testing since if there are no attributes its always an error response and if thats the case then we don't call Undecorate.

If the resource is not found we do return an from the ORM layer
https://github.com/flyteorg/flyteadmin/blob/db32bb3810e7490e04ff693eadd26414aa294482/pkg/repositories/gormimpl/resource_repo.go#L114

And which is propogated back to client
https://github.com/flyteorg/flyteadmin/blob/db32bb3810e7490e04ff693eadd26414aa294482/pkg/manager/impl/resources/resource_manager.go#L220

Hence i don't see how we can end up in this state of no error and empty response.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, just wanted to confirm you hadn't actually seen this behavior! protecting against it since it's technically allowed by the response structure sounds fine

flytectl delete execution-queue-attribute -p flytectldemo -d development


Deleting execution queue attribute using config file which was used for creating it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Deleting execution queue attribute using config file which was used for creating it.
Deletes execution queue attribute using config file which was used for creating it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks done



Deleting execution queue attribute using config file which was used for creating it.
Here the command deletes execution queue attributes from the config file cra.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why is this called cra? (copy paste from cluster resources attributes?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup . thanks for pointing it out. Fixed it.
Would need a code generator for comments for such cases.

- lightyear

Deleting execution queue attribute for a workflow
Here the command execution queue attributes for a workflow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it's missing a second half?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


flytectl get execution-queue-attribute -p flytectldemo -d development

eg : O/P
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is O/P?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its the output

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded it
eg : output from the command

Here the command get execution queue attributes for project flytectldemo and development domain.
::

flytectl get execution-queue-attribute -p flytectldemo -d development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add an example with a workflow name too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added for this and other attributes aswell.



Deleting execution queue attribute using config file which was used for creating it.
Here the command deletes execution queue attributes from the config file cra.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Here the command deletes execution queue attributes from the config file cra.yaml
Here the command deletes execution queue attributes from the config file era.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks


Deleting execution queue attribute using config file which was used for creating it.
Here the command deletes execution queue 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we note that the tags are optional in the file (since they're unread)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
Tags are optional in the file as they are unread during the delete command but can be kept as the same file can be used for get, update or delete
Added to other commands aswell

Base automatically changed from pmahindrakar/matchable-cluster-resources to master May 13, 2021 04:56
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
@pmahindrakar-oss pmahindrakar-oss force-pushed the pmahindrakar/matchable-execution-queue-attributes branch from 0f2030b to 175ed83 Compare May 13, 2021 06:26
@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #66 (de5efe9) into master (451c142) will increase coverage by 0.37%.
The diff coverage is 63.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   57.94%   58.31%   +0.37%     
==========================================
  Files          68       75       +7     
  Lines        1548     1653     +105     
==========================================
+ Hits          897      964      +67     
- Misses        596      633      +37     
- Partials       55       56       +1     
Flag Coverage Δ
unittests 58.31% <63.80%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/delete/matchable_cluster_resource_attribute.go 100.00% <ø> (ø)
cmd/delete/matchable_task_resource_attribute.go 100.00% <ø> (ø)
cmd/get/matchable_cluster_resource_attribute.go 100.00% <ø> (ø)
cmd/get/matchable_task_resource_attribute.go 100.00% <ø> (ø)
cmd/update/matchable_cluster_resource_attribute.go 100.00% <ø> (ø)
cmd/update/matchable_task_resource_attribute.go 100.00% <ø> (ø)
.../executionqueueattribute/attrdeleteconfig_flags.go 20.00% <20.00%> (ø)
...d/executionqueueattribute/attrfetchconfig_flags.go 20.00% <20.00%> (ø)
.../executionqueueattribute/attrupdateconfig_flags.go 20.00% <20.00%> (ø)
.../subcommand/executionqueueattribute/file_config.go 80.00% <80.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 451c142...de5efe9. Read the comment docs.

Signed-off-by: Prafulla Mahindrakar <[email protected]>
@pmahindrakar-oss pmahindrakar-oss requested a review from katrogan May 13, 2021 06:56
@pmahindrakar-oss pmahindrakar-oss merged commit f0e6770 into master May 14, 2021
@pmahindrakar-oss pmahindrakar-oss deleted the pmahindrakar/matchable-execution-queue-attributes branch May 14, 2021 01:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants