static private async void ProduceTest(ShardedDatasetClient client) { Expression <Func <int, IntKeyedDataset <int, int> > > sharder = x => new IntKeyedDataset <int, int>(x); var shardedIntKeyedDS = client.CreateShardedDataset <int, int, IntKeyedDataset <int, int> >(sharder); var deployedDS = await shardedIntKeyedDS.Deploy(); await deployedDS.Subscribe(() => new WriteToConsoleObserver <int, int>()); }
static private async void TransformTest1(ShardedDatasetClient client) { Expression <Func <int, IntKeyedDataset <int, int> > > sharder = x => new IntKeyedDataset <int, int>(x); var shardedIntKeyedDS = client.CreateShardedDataset <int, int, IntKeyedDataset <int, int> >(sharder); var deployedDS = await shardedIntKeyedDS.Transform <int, int, IntKeyedDataset <int, int> >(a => a.ShiftUp(1)) .Deploy(); await deployedDS.Subscribe(() => new WriteToConsoleObserver <int, int>()); }
static void Main(string[] args) { var storageConnectionString = Environment.GetEnvironmentVariable("AZURE_STORAGE_CONN_STRING"); // We assume two CRA instances with names: crainst0, crainst1 int workersCount = 2; DeploymentUtils.DefaultDeployDescriptor = new DeployDescriptorBase(CreateDefaultDeployer(workersCount)); var shardedDatasetClient = new ShardedDatasetClient(new AzureDataProvider(storageConnectionString)); ProduceTest(shardedDatasetClient); }
static private async void ShuffleTest1(ShardedDatasetClient client) { Expression <Func <int, IntKeyedDataset <int, int> > > sharder = x => new IntKeyedDataset <int, int>(x); var shardedIntKeyedDS = client.CreateShardedDataset <int, int, IntKeyedDataset <int, int> >(sharder); var deployedDS = await shardedIntKeyedDS.Transform <int, int, IntKeyedDataset <int, int> >(a => a.ShiftUp(1)) .Move <int, int, IntKeyedDataset <int, int>, int, int, IntKeyedDataset <int, int> >( (s, d) => s.Splitter(d), (m, d) => m.Merger(d), MoveDescriptor.MoveBase()) .Transform <int, int, IntKeyedDataset <int, int> >(a => a.ShiftUp(1)) .Deploy(); await deployedDS.Subscribe(() => new WriteToConsoleObserver <int, int>()); }