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

Filtering on activation state of workflows #305

Merged
merged 2 commits into from
Apr 8, 2022

Conversation

pmahindrakar-oss
Copy link
Contributor

TL;DR

Earlier behavior of flytectl get workflows -p project -d domain would call ListWorkflows api which would fetch all the workflows along with all versions which was incorrect

Instead now we use ListNamedEntities api to get unique workflows without the version
And allow the user to fetch all versions , latest version, or by given version of workflow by specifying the name of the workflow

Active state

flytectl get workflow -p flytesnacks -d development --filter.fieldSelector "state=0"  --filter.sortBy "created_at" 
 --------------- ------------- ------------------------------------------------------------- ------------- ------- 
| PROJECT (45)  | DOMAIN      | NAME                                                        | DESCRIPTION | STATE |
 --------------- ------------- ------------------------------------------------------------- ------------- ------- 
| flytesnacks   | development | core.containerization.use_secrets.my_secret_workflow        |             |       |
 --------------- ------------- ------------------------------------------------------------- ------------- ------- 
| flytesnacks   | development | core.control_flow.chain_tasks.chain_tasks_wf                |             |       |
 --------------- ------------- ------------------------------------------------------------- ------------- ------- 

By name

flytectl get workflow -p flytesnacks -d development --filter.fieldSelector "name=my.imperative.workflow.example"
 ------------- ------------- -------------------------------- ------------- ------- 
| PROJECT     | DOMAIN      | NAME                           | DESCRIPTION | STATE |
 ------------- ------------- -------------------------------- ------------- ------- 
| flytesnacks | development | my.imperative.workflow.example |             |       |
 ------------- ------------- -------------------------------- ------------- ------- 

Archive state

flytectl get workflow -p flytesnacks -d development --filter.fieldSelector "state=1" 
 ------------- ------------- ---------------------------------------- ------------------------ ------- 
| PROJECT     | DOMAIN      | NAME                                   | DESCRIPTION            | STATE |
 ------------- ------------- ---------------------------------------- ------------------------ ------- 
| flytesnacks | development | core.containerization.raw_container.wf | raw container workflow |       |
 ------------- ------------- ---------------------------------------- ------------------------ ------- 

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

How did you fix the bug, make the feature etc. Link to any design docs etc

Tracking Issue

flyteorg/flyte#2327

Follow-up issue

NA

@codecov
Copy link

codecov bot commented Apr 8, 2022

Codecov Report

Merging #305 (d23dba4) into master (fa21237) will decrease coverage by 0.06%.
The diff coverage is 43.75%.

@@            Coverage Diff             @@
##           master     #305      +/-   ##
==========================================
- Coverage   70.06%   70.00%   -0.07%     
==========================================
  Files         131      131              
  Lines        4533     4560      +27     
==========================================
+ Hits         3176     3192      +16     
- Misses       1133     1142       +9     
- Partials      224      226       +2     
Flag Coverage Δ
unittests 69.53% <42.85%> (-0.05%) ⬇️

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

Impacted Files Coverage Δ
pkg/ext/fetcher.go 100.00% <ø> (ø)
pkg/filters/util.go 72.72% <0.00%> (-24.84%) ⬇️
cmd/get/workflow.go 81.96% <75.00%> (+9.55%) ⬆️
pkg/ext/workflow_fetcher.go 84.21% <80.00%> (-1.51%) ⬇️

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 fa21237...d23dba4. Read the comment docs.

@@ -29,6 +30,25 @@ func BuildResourceListRequestWithName(c Filters, project, domain, name string) (
return request, nil
}

func BuildNamedEntityListRequest(c Filters, project, domain string, resourceType core.ResourceType) (*admin.NamedEntityListRequest, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: c Filters is kinda funky :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure . will fix this in followup

@pmahindrakar-oss pmahindrakar-oss merged commit d635116 into master Apr 8, 2022
@pmahindrakar-oss pmahindrakar-oss deleted the pmahindrakar/archive-workflow branch April 8, 2022 17:35
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.

3 participants