- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.helix.task.WorkflowConfig
类的一些代码示例,展示了WorkflowConfig
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowConfig
类的具体详情如下:
包路径:org.apache.helix.task.WorkflowConfig
类名称:WorkflowConfig
[英]Provides a typed interface to workflow level configurations. Validates the configurations.
[中]为工作流级别的配置提供类型化界面。验证配置。
代码示例来源:origin: apache/helix
public WorkflowConfig(WorkflowConfig cfg, String workflowId) {
this(workflowId, cfg.getJobDag(), cfg.getParallelJobs(), cfg.getTargetState(), cfg.getExpiry(),
cfg.getFailureThreshold(), cfg.isTerminable(), cfg.getScheduleConfig(), cfg.getCapacity(),
cfg.getWorkflowType(), cfg.isJobQueue(), cfg.getJobTypes(), cfg.getJobPurgeInterval(),
cfg.isAllowOverlapJobAssignment(), cfg.getTimeout());
}
代码示例来源:origin: apache/helix
/**
* @return Resource configuration key/value map.
* @throws HelixException
*/
public Map<String, String> getResourceConfigMap() throws HelixException {
return _workflowConfig.getResourceConfigMap();
}
代码示例来源:origin: org.apache.helix/helix-core
/**
* Check if a workflow is ready to schedule.
* @param workflowCfg the workflow to check
* @return true if the workflow is ready for schedule, false if not ready
*/
protected boolean isWorkflowReadyForSchedule(WorkflowConfig workflowCfg) {
Date startTime = workflowCfg.getStartTime();
// Workflow with non-scheduled config or passed start time is ready to schedule.
return (startTime == null || startTime.getTime() <= System.currentTimeMillis());
}
代码示例来源:origin: org.apache.helix/helix-core
for (String ancestor : workflowCfg.getJobDag().getAncestors(resourceName)) {
TaskState jobState = workflowCtx.getJobState(ancestor);
if (jobState == null || jobState == TaskState.NOT_STARTED) {
if (notStartedCount > 0 || (workflowCfg.isJobQueue() && inCompleteCount >= workflowCfg
.getParallelJobs())) {
LOG.debug("Job is not ready to be scheduled due to pending dependent jobs " + resourceName);
return emptyAssignment(resourceName, currStateOutput);
TargetState targetState = workflowCfg.getTargetState();
if (targetState == TargetState.DELETE) {
LOG.info(
&& workflowCtx.getFinishTime() + workflowCfg.getExpiry() <= System.currentTimeMillis()) {
LOG.info("Workflow " + workflowResource
+ " is completed and passed expiry time, cleaning up the workflow context.");
if (!workflowCfg.isTerminable() && jobFinishTime != WorkflowContext.UNFINISHED
&& jobFinishTime + workflowCfg.getExpiry() <= System.currentTimeMillis()) {
LOG.info("Job " + resourceName
+ " is completed and passed expiry time, cleaning up the job context.");
代码示例来源:origin: org.apache.helix/helix-core
/**
* Clean up a workflow. This removes the workflow config, idealstate, externalview and workflow
* contexts associated with this workflow, and all jobs information, including their configs,
* context, IS and EV.
*/
private void cleanupWorkflow(String workflow, WorkflowConfig workflowcfg) {
LOG.info("Cleaning up workflow: " + workflow);
if (workflowcfg.isTerminable() || workflowcfg.getTargetState() == TargetState.DELETE) {
Set<String> jobs = workflowcfg.getJobDag().getAllNodes();
// Remove all pending timer tasks for this workflow if exists
_rebalanceScheduler.removeScheduledRebalance(workflow);
for (String job : jobs) {
_rebalanceScheduler.removeScheduledRebalance(job);
}
if (!TaskUtil.removeWorkflow(_manager.getHelixDataAccessor(),
_manager.getHelixPropertyStore(), workflow, jobs)) {
LOG.warn("Failed to clean up workflow " + workflow);
}
} else {
LOG.info("Did not clean up workflow " + workflow
+ " because neither the workflow is non-terminable nor is set to DELETE.");
}
}
代码示例来源:origin: org.apache.helix/helix-core
private void removeWorkflowFromZK(String workflow) {
Set<String> jobSet = new HashSet<>();
// Note that even WorkflowConfig is null, if WorkflowContext exists, still need to remove workflow
WorkflowConfig wCfg = TaskUtil.getWorkflowConfig(_accessor, workflow);
if (wCfg != null) {
jobSet.addAll(wCfg.getJobDag().getAllNodes());
}
boolean success = TaskUtil.removeWorkflow(_accessor, _propertyStore, workflow, jobSet);
if (!success) {
LOG.info("Failed to delete the workflow " + workflow);
throw new HelixException("Failed to delete the workflow " + workflow);
}
}
代码示例来源:origin: apache/helix
TargetState targetState = workflowCfg.getTargetState();
if (targetState == TargetState.DELETE) {
LOG.info("Workflow is marked as deleted " + workflow + " cleaning up the workflow context.");
if (!workflowCfg.isJobQueue() && !finalStates.contains(workflowCtx.getWorkflowState())) {
scheduleRebalanceForTimeout(workflow, workflowCtx.getStartTime(), workflowCfg.getTimeout());
if (!TaskState.TIMED_OUT.equals(workflowCtx.getWorkflowState()) && isTimeout(workflowCtx.getStartTime(), workflowCfg.getTimeout())) {
workflowCtx.setWorkflowState(TaskState.TIMED_OUT);
_taskDataCache.updateWorkflowContext(workflow, workflowCtx);
long expiryTime = workflowCfg.getExpiry();
if (!workflowCfg.isTerminable() || workflowCfg.isJobQueue()) {
Set<String> jobWithFinalStates = new HashSet<>(workflowCtx.getJobStates().keySet());
jobWithFinalStates.removeAll(workflowCfg.getJobDag().getAllNodes());
if (jobWithFinalStates.size() > 0) {
workflowCtx.setLastJobPurgeTime(System.currentTimeMillis());
代码示例来源:origin: org.apache.helix/helix-core
TargetState targetState = workflowCfg.getTargetState();
if (targetState == TargetState.DELETE) {
LOG.info("Workflow is marked as deleted " + workflow + " cleaning up the workflow context.");
if (!workflowCfg.isJobQueue() && !finalStates.contains(workflowCtx.getWorkflowState())) {
scheduleRebalanceForTimeout(workflow, workflowCtx.getStartTime(), workflowCfg.getTimeout());
&& isTimeout(workflowCtx.getStartTime(), workflowCfg.getTimeout())) {
workflowCtx.setWorkflowState(TaskState.TIMED_OUT);
clusterData.updateWorkflowContext(workflow, workflowCtx, _manager.getHelixDataAccessor());
long expiryTime = workflowCfg.getExpiry();
workflowCfg.getStartTime().getTime());
return buildEmptyAssignment(workflow, currStateOutput);
if (!workflowCfg.isTerminable() || workflowCfg.isJobQueue()) {
purgeExpiredJobs(workflow, workflowCfg, workflowCtx);
代码示例来源:origin: apache/helix
if (newWorkflowConfig.getWorkflowId() == null || newWorkflowConfig.getWorkflowId().isEmpty()) {
newWorkflowConfig.getRecord()
.setSimpleField(WorkflowConfig.WorkflowConfigProperty.WorkflowID.name(), workflow);
if (workflow == null || !workflow.equals(newWorkflowConfig.getWorkflowId())) {
throw new HelixException(String
.format("Workflow name {%s} does not match the workflow Id from WorkflowConfig {%s}",
workflow, newWorkflowConfig.getWorkflowId()));
if (currentConfig.isTerminable()) {
throw new HelixException(
"Workflow " + workflow + " is terminable, not allow to change its configuration!");
newWorkflowConfig.setJobDag(currentConfig.getJobDag());
if (!TaskUtil.setWorkflowConfig(_accessor, workflow, newWorkflowConfig)) {
LOG.error("Failed to update workflow configuration for workflow " + workflow);
代码示例来源:origin: org.apache.helix/helix-core
WorkflowContext workflowCtx, Map<String, JobConfig> jobConfigMap,
ClusterDataCache clusterDataCache) {
ScheduleConfig scheduleConfig = workflowCfg.getScheduleConfig();
if (scheduleConfig != null && scheduleConfig.isRecurring()) {
LOG.debug("Jobs from recurring workflow are not schedule-able");
int scheduledJobs = 0;
long timeToSchedule = Long.MAX_VALUE;
for (String job : workflowCfg.getJobDag().getAllNodes()) {
TaskState jobState = workflowCtx.getJobState(job);
if (jobState != null && !jobState.equals(TaskState.NOT_STARTED)) {
if (workflowCfg.isJobQueue() && scheduledJobs >= workflowCfg.getParallelJobs()) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Workflow %s already have enough job in progress, "
代码示例来源:origin: org.apache.helix/helix-core
for (String job : cfg.getJobDag().getAllNodes()) {
TaskState jobState = ctx.getJobState(job);
if (jobState == TaskState.FAILED || jobState == TaskState.TIMED_OUT) {
failedJobs++;
if (!cfg.isJobQueue() && failedJobs > cfg.getFailureThreshold()) {
ctx.setWorkflowState(TaskState.FAILED);
LOG.info("Workflow {} reached the failure threshold, so setting its state to FAILED.", cfg.getWorkflowId());
for (String jobToFail : cfg.getJobDag().getAllNodes()) {
if (ctx.getJobState(jobToFail) == TaskState.IN_PROGRESS) {
ctx.setJobState(jobToFail, TaskState.ABORTED);
if (!incomplete && cfg.isTerminable()) {
ctx.setWorkflowState(TaskState.COMPLETED);
return true;
代码示例来源:origin: apache/incubator-gobblin
private void cleanUpJobs(HelixManager helixManager) {
// Clean up existing jobs
TaskDriver taskDriver = new TaskDriver(helixManager);
Map<String, WorkflowConfig> workflows = taskDriver.getWorkflows();
boolean cleanupDistJobs = ConfigUtils.getBoolean(this.config,
GobblinClusterConfigurationKeys.CLEAN_ALL_DIST_JOBS,
GobblinClusterConfigurationKeys.DEFAULT_CLEAN_ALL_DIST_JOBS);
for (Map.Entry<String, WorkflowConfig> entry : workflows.entrySet()) {
String workflowName = entry.getKey();
if (workflowName.contains(GobblinClusterConfigurationKeys.PLANNING_CONF_PREFIX)
|| workflowName.contains(GobblinClusterConfigurationKeys.ACTUAL_JOB_NAME_PREFIX)) {
if (!cleanupDistJobs) {
log.info("Distributed job {} won't be deleted.", workflowName);
continue;
}
}
WorkflowConfig workflowConfig = entry.getValue();
// request delete if not already requested
if (workflowConfig.getTargetState() != TargetState.DELETE) {
taskDriver.delete(workflowName);
log.info("Requested delete of workflowName {}", workflowName);
}
}
}
代码示例来源:origin: apache/helix
String workflowResource, String jobResource, ClusterDataCache cache) {
if (workflowCfg == null || workflowCfg.getScheduleConfig() == null) {
return true;
ScheduleConfig scheduleConfig = workflowCfg.getScheduleConfig();
Date startTime = scheduleConfig.getStartTime();
long currentTime = new Date().getTime();
if (!workflowCfg.getTargetState().equals(TargetState.START)) {
LOG.debug(
"Skip scheduling since the workflow has not been started " + workflowResource);
代码示例来源:origin: apache/helix
for (String jobName : workflowConfig.getJobDag().getAllNodes()) {
TaskState jobState = workflowContext.getJobState(jobName);
if (jobState == TaskState.IN_PROGRESS) {
for (String jobName : workflowConfig.getJobDag().getAllNodes()) {
JobContext jobContext = driver.getJobContext(jobName);
if (jobContext != null) {
if (!workflowConfig.isAllowOverlapJobAssignment()) {
Set<String> instances = new HashSet<String>();
for (JobContext jobContext : jobContextList) {
return maxRunningCount > 1 && (workflowConfig.isJobQueue() ? maxRunningCount <= workflowConfig
.getParallelJobs() : true);
代码示例来源:origin: org.apache.helix/helix-core
int incompleteParentCount = 0;
for (String parent : workflowCfg.getJobDag().getDirectParents(job)) {
TaskState jobState = workflowCtx.getJobState(parent);
if (jobState == null || jobState == TaskState.NOT_STARTED) {
if (workflowCfg.isJobQueue()) {
if (incompleteAllCount >= workflowCfg.getParallelJobs()) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Job %s is not ready to schedule, inCompleteJobs(s)=%d.", job,
代码示例来源:origin: org.apache.helix/helix-core
/**
* Checks if the workflow has completed.
* @param ctx Workflow context containing job states
* @param cfg Workflow config containing set of jobs
* @return returns true if all tasks are {@link TaskState#COMPLETED}, false otherwise.
*/
private static boolean isWorkflowComplete(WorkflowContext ctx, WorkflowConfig cfg) {
if (!cfg.isTerminable()) {
return false;
}
for (String job : cfg.getJobDag().getAllNodes()) {
if (ctx.getJobState(job) != TaskState.COMPLETED) {
return false;
}
}
return true;
}
代码示例来源:origin: org.apache.helix/helix-core
WorkflowContext workflowCtx, JobContext jobCtx, Set<Integer> partitionsToDropFromIs,
ClusterDataCache cache) {
TargetState jobTgtState = workflowConfig.getTargetState();
long finishTime = currentTime;
workflowCtx.setJobState(jobResource, TaskState.FAILED);
if (workflowConfig.isTerminable()) {
workflowCtx.setWorkflowState(TaskState.FAILED);
workflowCtx.setFinishTime(finishTime);
代码示例来源:origin: apache/helix
Set<String> ret = new HashSet<>();
if (!workflowCfg.isAllowOverlapJobAssignment()) {
for (String jobName : workflowCfg.getJobDag().getAllNodes()) {
if (jobName.equals(currentJobName)) {
continue;
代码示例来源:origin: apache/helix
@Override
public void execute(ClusterEvent event) {
ClusterDataCache clusterDataCache = event.getAttribute(AttributeName.ClusterDataCache.name());
HelixManager manager = event.getAttribute(AttributeName.helixmanager.name());
if (clusterDataCache == null || manager == null) {
LOG.warn(
"ClusterDataCache or HelixManager is null for event {}({}) in cluster {}. Skip TaskGarbageCollectionStage.",
event.getEventId(), event.getEventType(), event.getClusterName());
return;
}
Set<WorkflowConfig> existingWorkflows =
new HashSet<>(clusterDataCache.getWorkflowConfigMap().values());
for (WorkflowConfig workflowConfig : existingWorkflows) {
// clean up the expired jobs if it is a queue.
if (workflowConfig != null && (!workflowConfig.isTerminable() || workflowConfig
.isJobQueue())) {
try {
TaskUtil.purgeExpiredJobs(workflowConfig.getWorkflowId(), workflowConfig,
clusterDataCache.getWorkflowContext(workflowConfig.getWorkflowId()), manager,
_rebalanceScheduler);
} catch (Exception e) {
LOG.warn(String.format("Failed to purge job for workflow %s with reason %s",
workflowConfig.getWorkflowId(), e.toString()));
}
}
}
}
}
代码示例来源:origin: apache/helix
for (String job : workflowConfig.getJobDag().getAllNodes()) {
JobConfig jobConfig = TaskUtil.getJobConfig(dataAccessor, job);
JobContext jobContext = TaskUtil.getJobContext(propertyStore, job);
LOG.error(String.format(
"Job %s exists in JobDAG but JobConfig is missing! Job might have been deleted manually from the JobQueue: %s, or left in the DAG due to a failed clean-up attempt from last purge.",
job, workflowConfig.getWorkflowId()));
expiry = workflowConfig.getExpiry();
在流处理方面,Apache Beam和Apache Kafka之间有什么区别? 我也试图掌握技术和程序上的差异。 请通过您的经验报告来帮助我理解。 最佳答案 Beam是一种API,它以一种统一的方式使
有点n00b的问题。 如果我使用 Apache Ignite 进行消息传递和事件处理,是否还需要使用 Kafka? 与 Ignite 相比,Kafka 基本上会给我哪些(如果有的话)额外功能? 提前致
Apache MetaModel 是一个数据访问框架,它为发现、探索和查询不同类型的数据源提供了一个通用接口(interface)。 Apache Drill 是一种无架构的 SQL 查询引擎,它通过
Tomcat是一个广泛使用的java web服务器,而Apache也是一个web服务器,它们在实际项目使用中有什么不同? 经过一些研究,我有了一个简单的想法,比如, Apache Tomcat Ja
既然简单地使用 Apache 就足以运行许多 Web 应用程序,那么人们何时以及为什么除了 Apache 之外还使用 Tomcat? 最佳答案 Apache Tomcat是一个网络服务器和 Java
我在某个 VPS( friend 的带 cPanel 的 apache 服务器)上有一个帐户,我在那里有一个 public_html 目录。我们有大约 5-6 个网站: /home/myusernam
我目前正在尝试将模块加载到 Apache,使用 cmake 构建。该模块称为 mod_mapcache。它已成功构建并正确安装在/usr/lib/apache2/modules directroy 中
我对 url 中的问号有疑问。 例如:我有 url test.com/controller/action/part_1%3Fpart_2 (其中 %3F 是 url 编码的问号),并使用此重写规则:R
在同一台机器上,Apache 在端口 80 上运行,Tomcat 在端口 8080 上运行。 Apache 包括 html;css;js;文件并调用 tomcat 服务。 基本上 exampledom
Apache 1 和 Apache 2 的分支有什么区别? 使用一种或另一种的优点和缺点? 似乎 Apache 2 的缺点之一是使用大量内存,但也许它处理请求的速度更快? 最有趣的是 Apache 作
实际上,我们正在使用 Apache 网络服务器来托管我们的 REST-API。 脚本是用 Lua 编写的,并使用 mod-lua 映射。 例如来自 httpd.conf 的实际片段: [...] Lu
我在 apache 上的 ubuntu 中有一个虚拟主机,这不是我的主要配置,我有另一个网页作为我的主要网页,所以我想使用虚拟主机在同一个 IP 上设置这个。 urologyexpert.mx 是我的
我使用 Apache camel 已经很长时间了,发现它是满足各种系统集成相关业务需求的绝佳解决方案。但是几年前我遇到了 Apache Nifi 解决方案。经过一番谷歌搜索后,我发现虽然 Nifi 可
由于两者都是一次处理事件的流框架,这两种技术/流框架之间的核心架构差异是什么? 此外,在哪些特定用例中,一个比另一个更合适? 最佳答案 正如您所提到的,两者都是实时内存计算的流式平台。但是当您仔细观察
apache 文件(如 httpd.conf 和虚拟主机)中使用的语言名称是什么,例如 # Ensure that Apache listens on port 80 Listen 80 D
作为我学习过程的一部分,我认为如果我扩展更多关于 apache 的知识会很好。我有几个问题,虽然我知道有些内容可能需要相当冗长的解释,但我希望您能提供一个概述,以便我知道去哪里寻找。 (最好引用 mo
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 4 个月前关闭。 Improve
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
这个问题在这里已经有了答案: Difference Between Apache Kafka and Camel (Broker vs Integration) (4 个回答) 3年前关闭。 据我所知
我有 2 个使用相同规则的子域,如下所示: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond
我是一名优秀的程序员,十分优秀!