本文整理匯總了TypeScript中grid-client-core.IJobInfo類的典型用法代碼示例。如果您正苦於以下問題:TypeScript IJobInfo類的具體用法?TypeScript IJobInfo怎麽用?TypeScript IJobInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了IJobInfo類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: canKillJobMiddleware
function canKillJobMiddleware(req: express.Request, res: express.Response, next: express.NextFunction) {
let jobInfo = getJobInfo(req);
let user = getUser(req);
if (user.profile.canKillOtherUsersJob || user.userId === jobInfo.userId)
next();
else
res.status(401).json(errors.not_authorized);
}
示例2: getDispatcher
jobOperationRouter.get('/result', (req: express.Request, res: express.Response) => {
let dispatcher = getDispatcher(req);
let jobInfo = getJobInfo(req);
dispatcher.getJobResult(jobInfo.jobId)
.then((jobResult:IJobResult) => {
res.json(jobResult);
}).catch((err: any) => {
res.status(400).json(err);
});
});
示例3: getTaskResultMiddleware
function getTaskResultMiddleware(req: express.Request, res: express.Response, next: express.NextFunction) {
let jobInfo = getJobInfo(req);
let taskIndex:string = req.params['taskIndex'];
let t: number = parseInt(taskIndex);
if (isNaN(t) || t < 0 || t >= jobInfo.numTasks)
res.status(400).json(errors.bad_task_index);
else {
let dispatcher = getDispatcher(req);
dispatcher.getTaskResult({j: jobInfo.jobId, t})
.then((taskResult: ITaskResult) => {
req['taskResult'] = taskResult;
next();
}).catch((err: any) => {
res.status(400).json(err);
});
}
}
示例4:
jobOperationRouter.get('/info', (req: express.Request, res: express.Response) => {
res.json(getJobInfo(req));
});