本文整理汇总了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));
});