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

Question: PowerShell and GE #199

Closed
eosfor opened this issue May 7, 2018 · 10 comments
Closed

Question: PowerShell and GE #199

eosfor opened this issue May 7, 2018 · 10 comments
Milestone

Comments

@eosfor
Copy link

eosfor commented May 7, 2018

Hello colleagues, i'm trying to play around with GE using PowerShell. Actually I'm trying to make a module to work with GE using PowerShell.

So far i got a question. I have the following piece of code, which performs kid of initialization.

TrinityConfig.LogEchoOnConsole = LogEchoOnConsole;
LoggingConfig.Instance.LogDirectory = LogDirectory;
StorageConfig.Instance.StorageRoot = StorageRoot;

Global.Initialize();

LambdaDSL.SetDialect("MAG", "StartFrom", "VisitNode", "FollowEdge", "Action");
FanoutSearchModule.SetQueryTimeout(-1);

TrinityServer server = new TrinityServer();
server.RegisterCommunicationModule<FanoutSearchModule>();
server.Start();

However, when this runs as part of PowerShell module i see some noise on the PowerShell console, like this:

image

What do i do. How can i properly initialize an avoid any output to console? Or control this output?

@yatli
Copy link
Contributor

yatli commented May 8, 2018

hi @eosfor !
If you have set LogEchoOnConsole but still observe the 'noise' being scattered, you could try to work it around by setting LogLevel to Off.

@eosfor
Copy link
Author

eosfor commented May 8, 2018

Hello @yatli,

I've updated the call a bit.

This part passes the parameters from cmdlet to initialization routine and generates verbose output (in yellow)

if (!GlobalState.Instance.IsInitialized)
{
    WriteVerbose($"Setting LogDirectory to: {LogDirectory}");
    WriteVerbose($"Setting StorageRoot to: {StorageRoot}");
    WriteVerbose($"Setting LogEchoOnConsole to: {LogEchoOnConsole}");
    WriteVerbose($"Setting LogLevel to: {LogLevel}");

    GlobalState.Instance.Initialize(LogDirectory, StorageRoot, LogEchoOnConsole, LogLevel);
}

And this part is initialization itself

public void Initialize(string LogDirectory, string StorageRoot, bool LogEchoOnConsole, Trinity.Diagnostics.LogLevel LogLevel)
{
    if (!_isInitialized )
    {
        TrinityConfig.LogEchoOnConsole = LogEchoOnConsole;
        LoggingConfig.Instance.LogDirectory = LogDirectory;
        LoggingConfig.Instance.LoggingLevel = LogLevel;
        StorageConfig.Instance.StorageRoot = StorageRoot;

        Global.Initialize();

        LambdaDSL.SetDialect("MAG", "StartFrom", "VisitNode", "FollowEdge", "Action");
        FanoutSearchModule.SetQueryTimeout(-1);

        TrinityServer server = new TrinityServer();
        server.RegisterCommunicationModule<FanoutSearchModule>();
        server.Start();

        _isInitialized = true;
    }
}

And here is the output.

image

As you can see it still outputs stuff to a console for some reason.

@yatli
Copy link
Contributor

yatli commented May 8, 2018

Hmm, I think the options are flushed by initialization. I'll look into it shortly.
@leasunhy got time to take a look?

@eosfor
Copy link
Author

eosfor commented May 8, 2018

This is how it is happening

https://www.screencast.com/t/7zS7XjjHD7E

@yatli
Copy link
Contributor

yatli commented May 11, 2018

Looking into this now.

@yatli yatli added this to the Current milestone May 11, 2018
@yatli yatli closed this as completed in b3c61fd May 11, 2018
@yatli yatli reopened this May 11, 2018
@yatli
Copy link
Contributor

yatli commented May 11, 2018

@eosfor could you please pull master and try again? That should be a drop-in fix.

@eosfor
Copy link
Author

eosfor commented May 11, 2018

Sure @yatli, will do and let you know

@eosfor
Copy link
Author

eosfor commented May 11, 2018

@yatli, it works better now

image

However, there is an output left (marked on a screeshot), generated by this call:

image

@yatli
Copy link
Contributor

yatli commented May 11, 2018

Uh oh, this is probably from the storage composition module. It must be another Console.WriteLine...

Will fix this really soon!

cc @thautwarm

@yatli yatli closed this as completed in edc77a9 May 11, 2018
@yatli
Copy link
Contributor

yatli commented May 11, 2018

@eosfor should be alright now

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

No branches or pull requests

2 participants