當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.SchedulerDriverPtr函數代碼示例

本文整理匯總了Golang中C.SchedulerDriverPtr函數的典型用法代碼示例。如果您正苦於以下問題:Golang SchedulerDriverPtr函數的具體用法?Golang SchedulerDriverPtr怎麽用?Golang SchedulerDriverPtr使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了SchedulerDriverPtr函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SendFrameworkMessage

func (sdriver *SchedulerDriver) SendFrameworkMessage(
	executorId *ExecutorID,
	slaveId *SlaveID,
	data string) error {
	if sdriver.driver != nil {
		executorMessage, executorErr := serialize(executorId)
		if executorErr != nil {
			return executorErr
		}

		slaveMessage, slaveErr := serialize(slaveId)
		if slaveErr != nil {
			return slaveErr
		}

		var cdata *C.char = C.CString(data)

		C.scheduler_sendFrameworkMessage(
			C.SchedulerDriverPtr(sdriver.driver),
			&executorMessage,
			&slaveMessage,
			cdata)
	} else {
		return errors.New(
			"SendFrameworkMessage() failed: scheduler driver not initialized")
	}

	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:29,代碼來源:scheduler.go

示例2: DeclineOffer

func (sdriver *SchedulerDriver) DeclineOffer(
	offerId *OfferID,
	filters ...Filters) error {
	if sdriver.driver != nil {
		message, err := serialize(offerId)
		if err != nil {
			return err
		}

		var filters_ *C.ProtobufObj = nil
		if len(filters) > 1 {
			filtersObj, err := serialize(&filters[0])
			if err != nil {
				return err
			}

			filters_ = &filtersObj
		}

		C.scheduler_declineOffer(
			C.SchedulerDriverPtr(sdriver.driver),
			&message,
			filters_)
	} else {
		return errors.New("Start() failed: scheduler driver not initialized")
	}
	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:28,代碼來源:scheduler.go

示例3: RequestResources

func (sdriver *SchedulerDriver) RequestResources(requests []Request) error {
	if sdriver.driver != nil {
		var requestsData []byte
		for _, request := range requests {
			requestItemData, err := serializeItem(&request)
			if err != nil {
				return err
			}

			requestsData = append(requestsData, requestItemData...)
		}

		requestsObj := C.ProtobufObj{
			data: unsafe.Pointer(&requestsData[0]),
			size: C.size_t(len(requestsData)),
		}

		C.scheduler_requestResources(
			C.SchedulerDriverPtr(sdriver.driver),
			&requestsObj)
	} else {
		return errors.New(
			"RequestResources() failed: scheduler driver not initialized")
	}

	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:27,代碼來源:scheduler.go

示例4: ReviveOffers

func (sdriver *SchedulerDriver) ReviveOffers() error {
	if sdriver.driver != nil {
		C.scheduler_reviveOffers(C.SchedulerDriverPtr(sdriver.driver))
	} else {
		return errors.New("ReviveOffers() failed: scheduler driver not initialized")
	}
	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:8,代碼來源:scheduler.go

示例5: Join

func (sdriver *SchedulerDriver) Join() error {
	if sdriver.driver != nil {
		C.scheduler_join(C.SchedulerDriverPtr(sdriver.driver))
	} else {
		return errors.New("Join() failed: scheduler driver not initialized")
	}
	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:8,代碼來源:scheduler.go

示例6: Stop

func (sdriver *SchedulerDriver) Stop(failover bool) error {
	if sdriver.driver != nil {
		var failoverInt C.int = 0
		if failover {
			failoverInt = 1
		}

		C.scheduler_stop(C.SchedulerDriverPtr(sdriver.driver), failoverInt)
	} else {
		return errors.New("Stop() failed: scheduler driver not initialized")
	}
	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:13,代碼來源:scheduler.go

示例7: KillTask

func (sdriver *SchedulerDriver) KillTask(taskId *TaskID) error {
	if sdriver.driver != nil {
		message, err := serialize(taskId)
		if err != nil {
			return err
		}

		C.scheduler_killTask(C.SchedulerDriverPtr(sdriver.driver), &message)
	} else {
		return errors.New("KillTask() failed: scheduler driver not initialized")
	}

	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:14,代碼來源:scheduler.go

示例8: LaunchTasks

func (sdriver *SchedulerDriver) LaunchTasks(
	offerId *OfferID,
	tasks []*TaskInfo,
	filters ...Filters) error {

	if sdriver.driver != nil {
		offerObj, err := serialize(offerId)
		if err != nil {
			return err
		}

		var tasksData []byte
		for _, task := range tasks {
			taskItemData, err := serializeItem(task)
			if err != nil {
				return err
			}
			tasksData = append(tasksData, taskItemData...)
		}

		tasksObj := C.ProtobufObj{
			data: unsafe.Pointer(&tasksData[0]),
			size: C.size_t(len(tasksData)),
		}

		var filters_ *C.ProtobufObj = nil
		if len(filters) > 1 {
			filtersObj, err := serialize(&filters[0])
			if err != nil {
				return err
			}

			filters_ = &filtersObj
		}

		C.scheduler_launchTasks(
			C.SchedulerDriverPtr(sdriver.driver),
			&offerObj,
			&tasksObj,
			filters_)
	} else {
		return errors.New("LaunchTasks() failed: scheduler driver not initialized")
	}

	return nil
}
開發者ID:luffyhwl,項目名稱:gopark,代碼行數:46,代碼來源:scheduler.go


注:本文中的C.SchedulerDriverPtr函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。