Exemplo n.º 1
0
        public Status SendStatusUpdate(TaskStatus status)
        {
            var statusBytes = ProtoBufHelper.Serialize(status);

            using (var pinned = MarshalHelper.CreatePinnedObject(statusBytes))
                return((Status)NativeImports.ExecutorDriver.SendStatusUpdate(_nativeDriverPtr, pinned.Ptr));
        }
Exemplo n.º 2
0
        public Status RequestResources(IEnumerable <Request> requests)
        {
            var requestsBytes = requests.Select(ProtoBufHelper.Serialize);

            using (var pinned = MarshalHelper.CreatePinnedObject(requestsBytes))
                return((Status)NativeImports.SchedulerDriver.KillTask(_nativeDriverPtr, pinned.Ptr));
        }
Exemplo n.º 3
0
        public Status KillTask(TaskID taskId)
        {
            var taskIdBytes = ProtoBufHelper.Serialize(taskId);

            using (var pinned = MarshalHelper.CreatePinnedObject(taskIdBytes))
                return((Status)NativeImports.SchedulerDriver.KillTask(_nativeDriverPtr, pinned.Ptr));
        }
Exemplo n.º 4
0
        public Status ReconcileTasks(IEnumerable <TaskStatus> statuses)
        {
            var statusesArrays = statuses.Select(ProtoBufHelper.Serialize);

            using (var pinnedStatuses = MarshalHelper.CreatePinnedObject(statusesArrays))
                return((Status)NativeImports.SchedulerDriver.ReconcileTasks(_nativeDriverPtr, pinnedStatuses.Ptr));
        }
Exemplo n.º 5
0
        public Status AcknowledgeStatusUpdate(TaskStatus status)
        {
            var statusBytes = ProtoBufHelper.Serialize(status);

            using (var pinned = MarshalHelper.CreatePinnedObject(statusBytes))
                return((Status)NativeImports.SchedulerDriver.AcknowledgeStatusUpdate(_nativeDriverPtr, pinned.Ptr));
        }
Exemplo n.º 6
0
        public Status DeclineOffer(OfferID offerId, Filters filters)
        {
            var offerIdBytes = ProtoBufHelper.Serialize(offerId);
            var filtersBytes = ProtoBufHelper.Serialize(filters);

            using (var pinnedOfferId = MarshalHelper.CreatePinnedObject(offerIdBytes))
                using (var pinnedFilters = MarshalHelper.CreatePinnedObject(filtersBytes))
                    return((Status)NativeImports.SchedulerDriver.DeclineOffer(_nativeDriverPtr, pinnedOfferId.Ptr, pinnedFilters.Ptr));
        }
Exemplo n.º 7
0
        public Status SendFrameworkMessage(ExecutorID executorId, SlaveID slaveId, byte[] data)
        {
            var executorIdBytes = ProtoBufHelper.Serialize(executorId);
            var slaveIdBytes    = ProtoBufHelper.Serialize(slaveId);

            using (var pinnedExecutorId = MarshalHelper.CreatePinnedObject(executorIdBytes))
                using (var pinnedSlaveId = MarshalHelper.CreatePinnedObject(slaveIdBytes))
                    using (var pinnedData = MarshalHelper.CreatePinnedObject(data))
                        return((Status)NativeImports.SchedulerDriver.SendFrameworkMessage(_nativeDriverPtr, pinnedExecutorId.Ptr, pinnedSlaveId.Ptr, pinnedData.Ptr));
        }
Exemplo n.º 8
0
        public Status AcceptOffers(IEnumerable <OfferID> offerIds, IEnumerable <Offer.Operation> operations, Filters filters)
        {
            var offerIdsArrays   = offerIds.Select(ProtoBufHelper.Serialize);
            var operationsArrays = operations.Select(ProtoBufHelper.Serialize);
            var filtersBytes     = ProtoBufHelper.Serialize(filters);

            using (var pinnedOfferIdsArrays = MarshalHelper.CreatePinnedObject(offerIdsArrays))
                using (var pinnedOperationsArrays = MarshalHelper.CreatePinnedObject(operationsArrays))
                    using (var pinnedFiltersBytes = MarshalHelper.CreatePinnedObject(filtersBytes))
                        return((Status)NativeImports.SchedulerDriver.AcceptOffers(_nativeDriverPtr, pinnedOfferIdsArrays.Ptr, pinnedOperationsArrays.Ptr, pinnedFiltersBytes.Ptr));
        }
Exemplo n.º 9
0
        public Status LaunchTasks(IEnumerable <OfferID> offerIds, IEnumerable <TaskInfo> tasks, Filters filters)
        {
            var offerIdsArrays = offerIds.Select(ProtoBufHelper.Serialize);
            var tasksArrays    = tasks.Select(ProtoBufHelper.Serialize);
            var filtersBytes   = ProtoBufHelper.Serialize(filters);

            using (var pinnedOfferIdsArrays = MarshalHelper.CreatePinnedObject(offerIdsArrays))
                using (var pinnedTasksArrays = MarshalHelper.CreatePinnedObject(tasksArrays))
                    using (var pinnedFiltersBytes = MarshalHelper.CreatePinnedObject(filtersBytes))
                        return((Status)NativeImports.SchedulerDriver.LaunchTasks(_nativeDriverPtr, pinnedOfferIdsArrays.Ptr, pinnedTasksArrays.Ptr, pinnedFiltersBytes.Ptr));
        }
Exemplo n.º 10
0
        public void Initialize(long managedDriverId, FrameworkInfo frameworkInfo, string masterAddress, bool implicitAcknowledgements, Credential credential)
        {
            var schedulerInterface = SchedulerCallbacks.GetSchedulerInterface();

            var frameworkInfoBytes = ProtoBufHelper.Serialize(frameworkInfo);

            byte[] credentialBytes = null;
            if (credential != null)
            {
                credentialBytes = ProtoBufHelper.Serialize(credential);
            }

            unsafe
            {
                using (var pinnedFrameworkInfo = MarshalHelper.CreatePinnedObject(frameworkInfoBytes))
                    using (var pinnedCredential = MarshalHelper.CreatePinnedObject(credentialBytes))
                        _nativeDriverPtr = NativeImports.SchedulerDriver.Initialize(managedDriverId, &schedulerInterface,
                                                                                    pinnedFrameworkInfo.Ptr, masterAddress, implicitAcknowledgements, pinnedCredential.Ptr);
            }
        }
Exemplo n.º 11
0
 public Status SendFrameworkMessage(byte[] data)
 {
     using (var pinned = MarshalHelper.CreatePinnedObject(data))
         return((Status)NativeImports.ExecutorDriver.SendFrameworkMessage(_nativeDriverPtr, pinned.Ptr));
 }