本文整理汇总了Java中io.digdag.spi.TaskRequest.getTaskName方法的典型用法代码示例。如果您正苦于以下问题:Java TaskRequest.getTaskName方法的具体用法?Java TaskRequest.getTaskName怎么用?Java TaskRequest.getTaskName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.digdag.spi.TaskRequest
的用法示例。
在下文中一共展示了TaskRequest.getTaskName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newTaskLogger
import io.digdag.spi.TaskRequest; //导入方法依赖的package包/类
@Override
public TaskLogger newTaskLogger(TaskRequest request)
{
long attemptId = request.getAttemptId();
String taskName = request.getTaskName();
LogFilePrefix prefix;
try {
StoredSessionAttemptWithSession attempt =
tm.begin(() -> sm.getSessionStore(request.getSiteId()) .getAttemptById(attemptId),
ResourceNotFoundException.class);
prefix = logFilePrefixFromSessionAttempt(attempt);
}
catch (ResourceNotFoundException ex) {
throw new RuntimeException(ex);
}
return lm.newInProcessTaskLogger(agentId, prefix, taskName);
}
示例2: run
import io.digdag.spi.TaskRequest; //导入方法依赖的package包/类
@Override
public void run(TaskRequest request)
{
String fullName = request.getTaskName();
TaskResult result = cmd.skipTaskReports.apply(fullName);
String origThreadName = String.format("[%d:%s]%s", request.getSiteId(), request.getProjectName().or("----"), request.getTaskName());
if (result != null) {
try (SetThreadName threadName = new SetThreadName(origThreadName)) {
logger.warn("Skipped");
}
callback.taskSucceeded(request.getSiteId(),
request.getTaskId(), request.getLockId(), agentId,
result);
}
else {
super.run(request);
}
}
示例3: generateDefaultJobName
import io.digdag.spi.TaskRequest; //导入方法依赖的package包/类
private String generateDefaultJobName(TaskRequest request) {
/*
* prefix of default job name:
* <attempt-id>
*
* default job name:
* (1) <prefix-head>..
* (2) <prefix>
* (3) <prefix>:..<task-name-tail>
* (4) <prefix>:<task-name>
*/
String prefix = String.format("%d", request.getAttemptId());
String taskName = request.getTaskName();
// (1) <prefix-head>..
if (prefix.length() > RETZ_NAME_MAX) {
return prefix.substring(0, RETZ_NAME_MAX - NAME_ELLIPSIS.length()) + NAME_ELLIPSIS;
}
// (2) <prefix>
// we avoid non-ASCII characters for Retz database
if (prefix.length() > RETZ_NAME_MAX - 2 - NAME_ELLIPSIS.length()
|| taskName.chars().anyMatch(it -> it > 0x7f)) {
return prefix;
}
String candidate = String.format("%s:%s", prefix, taskName);
// (3) <prefix>:..<task-name-tail>
if (candidate.length() > RETZ_NAME_MAX) {
String prefixPlus = String.format("%s:%s", prefix, NAME_ELLIPSIS);
String taskNameTail = taskName.substring(
taskName.length() - (RETZ_NAME_MAX - prefixPlus.length()), taskName.length());
return String.format("%s%s", prefixPlus, taskNameTail);
}
// (4) <prefix>:<task-name>
return candidate;
}