Ejemplo n.º 1
0
        private static void CallExecutor(long managedDriverId, Action <MesosExecutorDriver, IExecutor> action)
        {
            var driver   = DriverRegistry.GetExecutorDriver(managedDriverId);
            var executor = driver.Executor;

            action(driver, executor);
        }
Ejemplo n.º 2
0
        private static void CallScheduler(long managedDriverId, Action <MesosSchedulerDriver, IScheduler> action)
        {
            var driver    = DriverRegistry.GetSchedulerDriver(managedDriverId);
            var scheduler = driver.Scheduler;

            action(driver, scheduler);
        }
Ejemplo n.º 3
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                GC.SuppressFinalize(this);
            }

            _bridge.Dispose();
            DriverRegistry.Unregister(this);
        }
Ejemplo n.º 4
0
        public MesosExecutorDriver(IExecutor executor)
        {
            if (executor == null)
            {
                throw new ArgumentNullException(nameof(executor));
            }

            Executor = executor;
            Id       = DriverRegistry.Register(this);
            _bridge  = new ExecutorDriverBridge();
            _bridge.Initialize(Id);
        }
Ejemplo n.º 5
0
        public bool Update(DriverRegistry driver)
        {
            _context.Driver.ReplaceOne(
                doc => doc.Id == driver.Id,
                driver,
                new UpdateOptions {
                IsUpsert = false
            }
                );

            return(true);
        }
Ejemplo n.º 6
0
        public IActionResult CreateDriver([FromBody] DriverRequest driver)
        {
            var driverToAdd = new DriverRegistry
            {
                Name             = driver.Name,
                Vehicle          = driver.Vehicle,
                Address          = driver.Address,
                FetchGeolocation = true,
                LastUpdated      = DateTime.UtcNow
            };

            _driverRepository.Add(driverToAdd);

            //For some reason, CreatedAtAction acts weird when I remove the 'value' parameter. It returns a wrong route to the 'location' header.
            return(CreatedAtAction(nameof(GetDriver), new { id = driverToAdd.Id }, driverToAdd));
        }
Ejemplo n.º 7
0
        public IActionResult UpdateDriver(string id, [FromBody] DriverRequest driver)
        {
            var driverToUpdate = new DriverRegistry
            {
                Id               = id,
                Name             = driver.Name,
                Vehicle          = driver.Vehicle,
                Address          = driver.Address,
                FetchGeolocation = true,
                LastUpdated      = DateTime.UtcNow
            };

            _driverRepository.Update(driverToUpdate);

            //Here CreatedAtAction acts normal with or without the 'value' parameter. But I will keep it here for the sake of consistency.
            return(CreatedAtAction(nameof(GetDriver), new { id = driverToUpdate.Id }, driverToUpdate));
        }
Ejemplo n.º 8
0
        public MesosSchedulerDriver(IScheduler scheduler, FrameworkInfo frameworkInfo, string masterAddress, bool implicitAcknowledgements, Credential credential)
        {
            if (scheduler == null)
            {
                throw new ArgumentNullException(nameof(scheduler));
            }
            if (frameworkInfo == null)
            {
                throw new ArgumentNullException(nameof(frameworkInfo));
            }
            if (masterAddress == null)
            {
                throw new ArgumentNullException(nameof(masterAddress));
            }

            Scheduler = scheduler;
            Id        = DriverRegistry.Register(this);
            _bridge   = new SchedulerDriverBridge();
            _bridge.Initialize(Id, frameworkInfo, masterAddress, implicitAcknowledgements, credential);
        }
Ejemplo n.º 9
0
        public bool Add(DriverRegistry driver)
        {
            _context.Driver.InsertOne(driver);

            return(true);
        }