reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Service <dsop...@gmail.com>
Subject Re: Tang problem
Date Thu, 13 Apr 2017 03:45:12 GMT
Fixed the issue by spending a long time stepping through the tang code.

Thanks if you took a look.

On Wed, Apr 12, 2017 at 10:57 PM, Douglas Service <dsopsrc@gmail.com> wrote:

> Given the following constructor.
>
>
>         [Inject]
>         private ClientNetworkService(
>             [Parameter(typeof(NetworkOptions.NetService))]
> INetworkService<string> networkService,
>             [Parameter(typeof(NetworkOptions.ServiceIdentifier))] string
> serviceIdentifier,
>             [Parameter(typeof(NetworkOptions.ServicePort))] int
> servicePort,
>             [Parameter(typeof(NetworkOptions.RemoteServiceIdentifier))]
> string remoteServiceIdentifier)
>
> with the following module builder
>
>
>         public sealed class ModuleBuilder : ConfigurationModuleBuilder
>         {
>             public static readonly RequiredParameter<INetworkService<string>>
> NetService = new RequiredParameter<INetworkService<string>>();
>             public static readonly RequiredParameter<string>
> ServiceIdentifier = new RequiredParameter<string>();
>             public static readonly RequiredParameter<int> ServicePort =
> new RequiredParameter<int>();
>             public static readonly RequiredParameter<string>
> RemoteServiceIdentifier = new RequiredParameter<string>();
>
>             // public static readonly RequiredParameter<IObserver<NsMessage<string>>>
> ClientMessageHandler
>             //  = new RequiredParameter<IObserver<NsMessage<string>>>();
>             // .BindNamedParameter(GenericType<NetworkOptions.kService>.Class,
> NetworkService)
>             public static readonly ConfigurationModule Config = new
> ModuleBuilder()
>                 .BindImplementation(GenericType<INetworkService<string>>.Class,
> GenericType<NetworkService<string>>.Class)
>                 .BindNamedParameter(GenericTyp
> e<NetworkOptions.NetService>.Class, GenericType<INetworkService<st
> ring>>.Class)
>                 .BindNamedParameter(GenericTyp
> e<NetworkOptions.ServiceIdentifier>.Class, ServiceIdentifier)
>                 .BindNamedParameter(GenericTyp
> e<NetworkOptions.ServicePort>.Class, ServicePort)
>                 .BindNamedParameter(GenericTyp
> e<NetworkOptions.RemoteServiceIdentifier>.Class, RemoteServiceIdentifier)
>                 .Build();
>
>                 // .BindNamedParameter(GenericTyp
> e<DistRNetworkOptions.MessageHandler>.Class, MessageHandler)
>         }
>
> When I try to inject,
>
>            IConfiguration nameClientConf = TangFactory.GetTang().NewConfi
> gurationBuilder()
>                 .BindNamedParameter<NamingConf
> igurationOptions.NameServerPort, int>(
>                     GenericType<NamingConfiguratio
> nOptions.NameServerPort>.Class,
>                     endpoint.Port.ToString(CultureInfo.CurrentCulture))
>                 .BindNamedParameter<NamingConf
> igurationOptions.NameServerAddress, string>(
>                     GenericType<NamingConfiguratio
> nOptions.NameServerAddress>.Class, endpoint.Address.ToString())
>                 .BindImplementation(GenericType<INameClient>.Class,
> GenericType<NameClient>.Class)
>                 .Build();
>
>             IConfiguration networkServiceConf =
> TangFactory.GetTang().NewConfigurationBuilder()
>                 .BindIntNamedParam<NetworkServ
> iceOptions.NetworkServicePort>(servicePort.ToString())
>                 .Build();
>
>             IConfiguration handlerConf = TangFactory.GetTang().NewConfi
> gurationBuilder()
>                 .BindImplementation<IObserver<NsMessage<string>>,
> ClientMessageHandler>()
>                 .Build();
>
>             !!!!!!!!!!!THROWS!!!!!!!!!!!!
>             IConfiguration clientNetworkConfig =
> NetworkOptions.ModuleBuilder.Config
>                 .Set(NetworkOptions.ModuleBuilder.NetService,
> GenericType<INetworkService<string>>.Class)
>                 .Set(NetworkOptions.ModuleBuilder.ServiceIdentifier,
> clientId)
>                 .Set(NetworkOptions.ModuleBuilder.ServicePort,
> servicePort.ToString())
>                 .Set(NetworkOptions.ModuleBuilder.RemoteServiceIdentifier,
> driverId)
>                 .Build();
>
>             TangFactory.GetTang().NewInjector(GetRuntimeConfiguration(args.Length
> > 0 ? args[0] : Local),
>                 nameClientConf, networkServiceConf, handlerConf,
> clientNetworkConfig).GetInstance<DistributedRClient>().Run();
>
> the line with "!!!!!!!!!!!THROWS!!!!!!!!!!!!"  throws this exception
>
>
> System.TypeInitializationException occurred
>   HResult=0x80131534
>   Message=The type initializer for 'ModuleBuilder' threw an exception.
>   Source=Org.Apache.REEF.DistributedR
>   StackTrace:
>    at Org.Apache.REEF.DistributedR.DistributedRClient.Main(String[] args)
> in E:\reef\lang\cs\Org.Apache.REEF.DistributedR\DistributedRClient.cs:line
> 184
>
> Inner Exception 1:
> ClassHierarchyException: Found declared options that were not used in
> binds: { NetService }
>
>
> However when I remove it and the corresponding code in the ModuleBuilder,
> I also get an exception about not being able to RDistributedR class.
>
> What am i missing?
>
> Doug
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message