Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WorkflowRunsOperations.list arguments top and filter not working? #21932

Closed
c4g-wv opened this issue Nov 30, 2021 · 14 comments
Closed

WorkflowRunsOperations.list arguments top and filter not working? #21932

c4g-wv opened this issue Nov 30, 2021 · 14 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Logic App Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@c4g-wv
Copy link

c4g-wv commented Nov 30, 2021

Dear,

I'm trying to use the list method of the WorkflowRunsOperations, but when I specify top=5 for example, I still seem to be getting all runs. It's as if the top argument is not taken into account?
Additionally, I'm trying to use the filter on StartTime, but keeps giving a "not valid or not supported" error. Things I've tried so far:

  • filter="StartTime>2021-11-23 00:00:00"
  • filter="StartTime>2021-11-23Z00:00:00"
  • filter="StartTime>'2021-11-23Z00:00:00'"
  • filter="StartTime>'2021-11-23'"
  • filter="StartTime>2021-11-23"

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 30, 2021
@c4g-wv
Copy link
Author

c4g-wv commented Nov 30, 2021

For the "filter" argument, the right syntax seems to be:
StartTime gt 2021-11-23T00:00:00Z
Might be good to add to docmentation.

For the "top" argument, still not picking up the integer value, also tried passing it as string.

@YalinLi0312
Copy link

@c4g-wv Thanks for your feedback, we'll investigate asap.

@YalinLi0312 YalinLi0312 added the Mgmt This issue is related to a management-plane library. label Nov 30, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 30, 2021
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Nov 30, 2021
@SaurabhSharma-MSFT SaurabhSharma-MSFT self-assigned this Dec 1, 2021
@SaurabhSharma-MSFT
Copy link
Member

@c4g-wv Would you mind providing the code snippet you are using to get the results ?

@c4g-wv
Copy link
Author

c4g-wv commented Dec 2, 2021

@SaurabhSharma-MSFT test code could look something like this:

logicClient = LogicManagementClient(DefaultAzureCredential(), *sanitized subscr id*)
it = logicClient.workflow_runs.list(*sanitized rg name*,*logic app name*,top=1)
for i in it:
	print(i)

fyi: tested it on python 3.8 and 3.9

@SaurabhSharma-MSFT
Copy link
Member

@c4g-wv I have tested this in my environment and you are correct filter works with the time format - 2021-11-23T00:00:00Z.
image

Also, I have also tried with using top but it does not work for me either.
Though I have tested the Workflow-Runs rest API and it worked fine with REST endpoint.
https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Logic/workflows/{{workflowName}}/runs?api-version=2016-06-01&$filter=StartTime ge 2021-11-23T00:00:00Z&$top=2

I am checking internally on the same and get back to you.

Thanks
Saurabh

@PramodValavala-MSFT
Copy link
Contributor

@c4g-wv the list method here returns an object of type AsyncItemPaged which basically iterates through all the pages until there are none. The top parameter is actually working here but you end looping through pages of 5 entries. Either you could use a regular for loop and it.next() the fixed number of times like this

logicClient = LogicManagementClient(DefaultAzureCredential(), "sub-id")
it = logicClient.workflow_runs.list("rg-name", "la-name", top = 5)
for i in range(0, 5):
    curr = it.next()
    print(curr)

Or just loop through the first page like this

logicClient = LogicManagementClient(DefaultAzureCredential(), "sub-id")
pages = logicClient.workflow_runs.list("rg-name", "la-name", top = 5).by_page()
for i in pages.next():
    print(i)

@c4g-wv
Copy link
Author

c4g-wv commented Dec 9, 2021

@PramodValavala-MSFT : thanks for looking into it. I agree, there are workarounds, but it's not how I expect it to work. Through REST API, it is properly giving 1 result back. Also, the "filter" argument is giving a proper reduced list (both in REST API and logicClient.workflow_runs.list function), so I'm not quite clear why it would have to be different for the "top" argument.

@PramodValavala-MSFT PramodValavala-MSFT self-assigned this Dec 9, 2021
@PramodValavala-MSFT
Copy link
Contributor

@c4g-wv You are right. In fact, the first response does return just five results, but the problem seems to be that the service returns a nextLink which the SDK uses to fetch consequent pages when iterating. AFAIK it should not be set when using top but either way, I will share this feedback with the concerning team and get back to you.

@SaurabhSharma-MSFT
Copy link
Member

@c4g-wv Please let us know if you have any additional questions else we will proceed with the closure of this issue.

@c4g-wv
Copy link
Author

c4g-wv commented Dec 28, 2021

@SaurabhSharma-MSFT : Personally, I don't consider the issue closed. There is a workaround, I agree, but the parameter does not behave the way it's supposed to behave. Though, if the development team has decided not to fix it, then you can go ahead with closure.

@BigCat20196 BigCat20196 added the Service Attention Workflow: This issue is responsible by Azure service team. label Mar 3, 2022
@ghost
Copy link

ghost commented Mar 3, 2022

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-logicapps-team.

Issue Details

Dear,

I'm trying to use the list method of the WorkflowRunsOperations, but when I specify top=5 for example, I still seem to be getting all runs. It's as if the top argument is not taken into account?
Additionally, I'm trying to use the filter on StartTime, but keeps giving a "not valid or not supported" error. Things I've tried so far:

  • filter="StartTime>2021-11-23 00:00:00"
  • filter="StartTime>2021-11-23Z00:00:00"
  • filter="StartTime>'2021-11-23Z00:00:00'"
  • filter="StartTime>'2021-11-23'"
  • filter="StartTime>2021-11-23"

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Author: c4g-wv
Assignees: SaurabhSharma-MSFT, PramodValavala-MSFT, msyyc
Labels:

question, Logic App, Service Attention, Mgmt, customer-reported, needs-team-attention, CXP Attention

Milestone: -

@xiangyan99
Copy link
Member

Given the linked PR was closed as completed. I will close this one. Please feel free to reopen it if it is not solved.

@xiangyan99 xiangyan99 added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Jun 17, 2022
@ghost
Copy link

ghost commented Jun 17, 2022

Hi @c4g-wv. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

@ghost ghost removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 17, 2022
@ghost
Copy link

ghost commented Jun 24, 2022

Hi @c4g-wv, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

@ghost ghost closed this as completed Jun 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Logic App Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

7 participants