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-6232: Add No-network mode #14526

Merged
merged 29 commits into from
Oct 30, 2023
Merged

Conversation

aparajit-pratap
Copy link
Contributor

@aparajit-pratap aparajit-pratap commented Oct 25, 2023

Purpose

Added a new no-network mode to Dynamo. This does away with the need to maintain a separate special build for Alias as this option has been added to the mainline.

Changes include:

  • Added a new command line argument for a no-network mode to sandbox and CLIs
  • Separation of concerns between DisableAnalytics and NoNetworkMode flags - Now it's possible to disable analytics even when online
  • Changed some public APIs: https://github.com/DynamoDS/Dynamo/wiki/API-Changes-in-Dynamo-3.0
  • Manually tested NoNetworkMode for network traffic and verified zero traffic using process monitor
  • Manually tested for ML node autocomplete, sign-in, notifications for both modes and found them to be enabled and disabled as appropriate for each of the settings
  • Hosts like Revit will need to add the NoNetworkMode property to their custom start configuration types
  • Removed obsolete analytics/instrumentation properties and associated tests

No-network mode disables the following:

  • Sign-in and the ability to publish packages online
  • Notification center
  • ML node autocomplete requests are blocked
  • Disables usage agreement (consent dialog)

Note: I didn't end up adding any unit tests as it wasn't straightforward. I could add a follow-up for tests.

Follow-up tasks:

TODO:

  • Add details of things that are disabled to release notes
  • List API changes
  • Update TM

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

@aparajit-pratap aparajit-pratap changed the title Add No-network mode DYN-6232: Add No-network mode Oct 25, 2023
/// <summary>
/// Configuration option to start Dynamo in offline mode.
/// </summary>
bool NoNetworkMode { get; set; }
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 allows host integrators to control this flag in their custom startup configurations or by setting it while creating a DefaultStartConfiguration.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this is a good time to do this TODO on line 512
I was mentioning this to @QilongTang today on slack.

// TODO_Dynamo3.0: Replace the IStartConfiguration with a class or struct instance in order to avoid future breaking changes for every new option added.

We could also look at interfaces with defaults - though I am not sure we can use default properties...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made this a default property as suggested. Hopefully, it shouldn't be a breaking change any longer.

Copy link
Member

Choose a reason for hiding this comment

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

they're not as straight forward to use as I thought... the objects only seem to inherit the default implementations when they are declared as those interfaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean code using RevitStartConfiguration, for example, will need to be recompiled? I'm not sure I follow what you're suggesting we do here.

if (!Dynamo.Logging.Analytics.DisableAnalytics)

//we don't ask dpm for known hosts in offline mode.
if (!noNetworkMode)
{
// Known hosts
knownHosts = PackageManagerClient.GetKnownHosts();
Copy link
Member

Choose a reason for hiding this comment

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

I think that for 2.19.1 I implemented something similar but also defaulted to some known hosts, can we unify that logic? I can't recall where though.

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 what I was referring to: https://github.com/DynamoDS/Dynamo/compare/RC2.19.0_master..RC2.19.1_master (a comparison between 2.19.1 and 2.19.0). The changes that went into 2.19.1 somehow also seemed to be present in master so I didn't need to do anything extra.

I haven't changed the logic other than replacing DisableAnalytics with noNetworkMode. Please let me know if I'm missing something.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the defualts are in this PR
IEnumerable<string> knownHosts = new List<string> { "Revit", "Civil 3D", "Alias", "Advance Steel", "FormIt" };

@@ -64,7 +67,7 @@ internal class CMDLineOptions
public bool ServiceMode { get; set; }
}

public class StartupUtils
public static class StartupUtils
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be too much of a breaking change to make this internal ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why are you suggesting we make this internal?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to reduce the number public footprint. Do you think it is valuable as public facing API or risky to make internal?

/// <returns></returns>
public static DynamoModel MakeCLIModel(string asmPath, string userDataFolder, string commonDataFolder, HostAnalyticsInfo info = new HostAnalyticsInfo(), bool isServiceMode = false)
public static DynamoModel MakeCLIModel(CommandLineArguments cmdLineArgs)
Copy link
Contributor

Choose a reason for hiding this comment

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

we are ok with breaking changes right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

/// <summary>
/// For nunit-teardown
/// </summary>
internal void ForceShutDownAllApps()
Copy link
Contributor

Choose a reason for hiding this comment

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

not used anymore ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no


[Test]
[Category("Failure")]
public void DummyDisposableEvents()
Copy link
Contributor

Choose a reason for hiding this comment

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

is anything in this test still useful ?
@QilongTang FYI

@QilongTang QilongTang added this to the 3.0 milestone Oct 27, 2023
@aparajit-pratap aparajit-pratap merged commit 923663e into DynamoDS:master Oct 30, 2023
18 checks passed
@aparajit-pratap aparajit-pratap deleted the noNetwork branch October 30, 2023 18:10
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