public static ResourceLocalizationSpec NewResourceLocalizationSpec(LocalResource rsrc, Path path) { URL local = ConverterUtils.GetYarnUrlFromPath(path); ResourceLocalizationSpec resourceLocalizationSpec = Org.Apache.Hadoop.Yarn.Util.Records .NewRecord <ResourceLocalizationSpec>(); resourceLocalizationSpec.SetDestinationDirectory(local); resourceLocalizationSpec.SetResource(rsrc); return(resourceLocalizationSpec); }
/// <exception cref="Sharpen.URISyntaxException"/> internal static LocalizerHeartbeatResponse CreateLocalizerHeartbeatResponse() { LocalizerHeartbeatResponse ret = recordFactory.NewRecordInstance <LocalizerHeartbeatResponse >(); NUnit.Framework.Assert.IsTrue(ret is LocalizerHeartbeatResponsePBImpl); ret.SetLocalizerAction(LocalizerAction.Live); LocalResource rsrc = CreateResource(); AList <ResourceLocalizationSpec> rsrcs = new AList <ResourceLocalizationSpec>(); ResourceLocalizationSpec resource = recordFactory.NewRecordInstance <ResourceLocalizationSpec >(); resource.SetResource(rsrc); resource.SetDestinationDirectory(ConverterUtils.GetYarnUrlFromPath(new Path("/tmp" + Runtime.CurrentTimeMillis()))); rsrcs.AddItem(resource); ret.SetResourceSpecs(rsrcs); System.Console.Out.WriteLine(resource); return(ret); }