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

DYN-6052 Add node info event and API under DynamoServices package for ProtoCore #14234

Merged
merged 8 commits into from
Aug 15, 2023

Conversation

QilongTang
Copy link
Contributor

@QilongTang QilongTang commented Aug 7, 2023

Please Note:

  1. Before submitting the PR, please review How to Contribute to Dynamo
  2. Dynamo Team will meet 1x a month to review PRs found on Github (Issues will be handled separately)
  3. PRs will be reviewed from oldest to newest
  4. If a reviewed PR requires changes by the owner, the owner of the PR has 30 days to respond. If the PR has seen no activity by the next session, it will be either closed by the team or depending on its utility will be taken over by someone on the team
  5. PRs should use either Dynamo's default PR template or one of these other template options in order to be considered for review.
  6. PRs that do not have one of the Dynamo PR templates completely filled out with all declarations satisfied will not be reviewed by the Dynamo team.
  7. PRs made to the DynamoRevit repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after a LGTM label is added to the PR.

Purpose

  • Add node info event and API under DynamoServices package for ProtoCore so libG could raise info message instead of warning message.
  • Add mechanism for graph run to consume runtime infos and connect each of them with node.

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

(FILL ME IN) Brief description of the fix / enhancement. Mandatory section

Reviewers

(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)

(FILL ME IN, optional) Any additional notes to reviewers or testers.

FYIs

(FILL ME IN, Optional) Names of anyone else you wish to be notified of

public Guid GraphNodeGuid;
public int AstID;
public string Filename;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wish we didn’t have to expose more APIs from the engine level

Copy link
Contributor Author

@QilongTang QilongTang Aug 8, 2023

Choose a reason for hiding this comment

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

I did look at it but unfortunately because the current public interface ILiveRunner setup, the function involved needs to be public and also the return object as well. VS does throw errors if trying to make this internal. I have made as much as I can internal or private

Copy link
Member

Choose a reason for hiding this comment

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

Is this really a good candidate for a struct?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjkkirschner I am not sure but maybe we could break these changes in 3.0. Right now I am just following the previous design for all these engine related code

continue;
using (node.PropertyChangeManager.SetPropsToSuppress(nameof(NodeModel.ToolTipText), nameof(NodeModel.Infos), nameof(NodeModel.State)))
{
node.Info(string.Join(Environment.NewLine, info.Value.Select(w => w.Message)));
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 is the place where we would display node info returned from libG

@@ -99,6 +139,7 @@ public void ClearWarningForExpression(int expressionID)
using (rwl.CreateWriteLock())
{
warnings.RemoveAll(w => w.ExpressionID == expressionID);
infos.RemoveAll(w => w.ExpressionID == expressionID);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aparajit-pratap I am not 100% sure about the usage of these function or if infos need to be reset. But I guess we want to clear the runtime infos every time graph runs. Please correct me if I was wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

This could be tricky. In the case of geometry scale info messages, we would want it to be associated with node execution, while in other contexts, it may just be a static info message that has nothing to do with the node execution, in which case this may not be applicable.

public static class LogInfoMessageEvents
{
public static event LogInfoMessageEventHandler LogInfoMessage;
public static void OnLogInfoMessage(string message)
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 is the new API ProtoGeometry will call to raise info instead of warning

@QilongTang QilongTang changed the title [WIP] Add node info event and API under DynamoServices package for ProtoCore DYN-6052 Add node info event and API under DynamoServices package for ProtoCore Aug 8, 2023
@QilongTang QilongTang added this to the 2.19.0 milestone Aug 8, 2023
@QilongTang QilongTang marked this pull request as ready for review August 8, 2023 20:29
Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

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

@QilongTang I tried an alternative approach using VMDataBridge in the referenced PR, please check it out. It avoids having to make these many changes at the VM level.

Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

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

@QilongTang I'm okay with going ahead with this PR instead of mine as I wasn't able to figure out how to clear Info messages using the VM Databridge approach. If you could address review comments made so far, that would be great.

@QilongTang
Copy link
Contributor Author

Addressed the comments, the unit test with an example of a large number node triggering info cant be tested without the change to libG side. So I may merge this first and have a follow-up PR to add unit test.

Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

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

Few more comments.

@QilongTang
Copy link
Contributor Author

Since we do not have 3.0 build working yet, I will have to merge to master -> cherry-pick to 2.19 branch and then use a 2.19 beta nuget to test. Merging.

@QilongTang QilongTang merged commit c15e215 into master Aug 15, 2023
@QilongTang QilongTang deleted the NodeInfoAPIUnderNodeServices branch August 15, 2023 04:45
QilongTang added a commit that referenced this pull request Aug 15, 2023
… ProtoCore (#14234)

* Add node info event and API

* Update

* Update

* clean up

* remove line and column from InfoEntry

* comments

* clean up

* clean up
@QilongTang QilongTang mentioned this pull request Aug 15, 2023
9 tasks
QilongTang added a commit that referenced this pull request Aug 15, 2023
* DYN-6052 Add node info event and API under DynamoServices package for ProtoCore (#14234)

* Add node info event and API

* Update

* Update

* clean up

* remove line and column from InfoEntry

* comments

* clean up

* clean up

* update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants