Esempio 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);
        }
Esempio 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);
        }
Esempio n. 3
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                GC.SuppressFinalize(this);
            }

            _bridge.Dispose();
            DriverRegistry.Unregister(this);
        }
Esempio 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);
        }
Esempio n. 5
0
        public bool Update(DriverRegistry driver)
        {
            _context.Driver.ReplaceOne(
                doc => doc.Id == driver.Id,
                driver,
                new UpdateOptions {
                IsUpsert = false
            }
                );

            return(true);
        }
Esempio 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));
        }
Esempio 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));
        }
Esempio 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);
        }
Esempio n. 9
0
        public bool Add(DriverRegistry driver)
        {
            _context.Driver.InsertOne(driver);

            return(true);
        }