-
Notifications
You must be signed in to change notification settings - Fork 37
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
[BUG] Updating a template unnecessarily checks for the existence of a template we'll overwrite #678
Comments
Hi, @dbwiddis. I haven't come across an any protocol in the documentation on how to assign an Issue to myself. So to prevent anyone else from working on it I am assigning it to myself now. Please correct me if I am mistaken. |
Hey @JamieBort welcome! Not sure if you have permission to assign to yourself, but I'm assigning it to you! Let me know if you have any questions. |
Does it matter what branch name I use? EDIT - if the answers to these questions are in the contribution documentation, please let me know. I know you're busy and while I have looked there already, I rather get familiar with the documentation sooner than later. |
Nope, we use a triangle workflow (you can google that) but basically:
If all that works, push ( To respond to PR review comments, just edit your code, commit, and push (to your fork) and the PR will automatically get updated.
Not here.
You can fork at any time.
A lot of this is at https://github.com/opensearch-project/flow-framework/blob/main/DEVELOPER_GUIDE.md but you can let us know if there's any way we can clarify that! |
All of this is very helpful. Thank you! I am familiar with the Developer Guide that you shared. (Thank you for that.) But neglected to read about And I am sorry to say that this will be my introduction to writing tests as well. I feel I have a clear understanding for how the code needs to be refactored. (To me that's the easiest part of this task.) However I am concerned about accomplishing this in a timely manner. Do you have a deadline for this? |
No deadline. It's a nice-to-have. Next release code freeze is about 6 weeks away but if you don't make that... not an issue! |
As far as testing, the method you're changing is already covered by tests, so either it will fail, or it will pass but include an unneeded mock of an index response. Either way, find the associated test and make sure it accurately reflects what the method does. |
I've made my changes (Step 5 from #678 (comment)). However when I run I am new to Gradle, however so I'm trying to do my due diligence by understand it better. And by attempting to answer my own questions with a little research before I start posting them here. That said, I'm sharing the complete output in a .txt file for completeness: To complicate matters the report states Something I'll be looking into is my JDK version.
If that is the culprit I'll need up switch to 14 from 13:
|
Hey Jamie, thanks for the update!
This is probably a test depending on the old behavior that you just removed as I implied in this comment. The stack trace after the failed test shows the failed assertion:
I'm not sure exactly which line 184 corresponds to yours, but it seems to be the last assertion in this test: Lines 170 to 192 in e3a8784
Note that whole test was designed to check the line of code that you're removing (checking whether the template exists before updating it) so it seems you might be able to remove that test entirely. However, I assume you must have added error handling for the state document (or its index) not existing, so you might want to look at |
Don't worry about any JDK other than 11, 17, or 21. We use JDK17+ on the main branch and 11 on the 2.x branch which this will be backported to, but since you're building against main then 17 or 21 (or any JDK post 14) should work. |
One other note, we do measure test coverage; codecov will make a comment on a PR (if tests are successful) indicating any uncovered lines, so even if you don't add a new test immediately then after that runs, it can show you uncovered new lines. It's possible to run this code locally with |
One other helpful hint. You can see the logged error message in your output:
So the test failure was looking for an exception message containing "Failed to get template" but I expect the message was something about global context index not existing. |
Hey @JamieBort hope you're doing well and making good progress. @joshpalis is working on implementing #717 which is using the same "PUT" update API that was assumed when writing this issue. In his case, he needs the previous template in order to compare steps. I do think he may be fetching that template earlier in the REST/Transport sequence but since he doesn't have a draft PR out yet I haven't seen his implementation. So I wanted to call his attention to this issue and make sure he's not making any changes to the |
Hi, @dbwiddis. Thank you for letting me know. And yes, I'm still here! |
Hi, @dbwiddis. I just sent you a message via LinkedIn. In short, while I'd very much like to contribute to this repo, I think it is best that I unassign myself from this Issue. At least for the time being. |
What is the bug?
When updating a template, we perform two get requests, one to check for the existence of the template (that we are going to overwrite), and a second one to get the provisioning status:
flow-framework/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java
Lines 409 to 423 in bae3aa2
What is the expected behavior?
We should query the state index once for the provisioning status, and assume if the state doesn't exist, the template doesn't either. Since we are overwriting the template it doesn't matter whether it exists if the state is other than NOT_STARTED.
The text was updated successfully, but these errors were encountered: