-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Joshua Palis <[email protected]>
- Loading branch information
Showing
17 changed files
with
400 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/org/opensearch/flowframework/common/FlowFrameworkSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.flowframework.common; | ||
|
||
import org.opensearch.common.settings.Setting; | ||
import org.opensearch.common.unit.TimeValue; | ||
|
||
/** The common settings of flow framework */ | ||
public class FlowFrameworkSettings { | ||
|
||
private FlowFrameworkSettings() {} | ||
|
||
/** The upper limit of max workflows that can be created */ | ||
public static final int MAX_WORKFLOWS_LIMIT = 10000; | ||
|
||
/** This setting sets max workflows that can be created */ | ||
public static final Setting<Integer> MAX_WORKFLOWS = Setting.intSetting( | ||
"plugins.flow_framework.max_workflows", | ||
1000, | ||
0, | ||
MAX_WORKFLOWS_LIMIT, | ||
Setting.Property.NodeScope, | ||
Setting.Property.Dynamic | ||
); | ||
|
||
/** This setting sets the timeout for the request */ | ||
public static final Setting<TimeValue> WORKFLOW_REQUEST_TIMEOUT = Setting.positiveTimeSetting( | ||
"plugins.flow_framework.request_timeout", | ||
TimeValue.timeValueSeconds(10), | ||
Setting.Property.NodeScope, | ||
Setting.Property.Dynamic | ||
); | ||
|
||
/** This setting enables/disables the Flow Framework REST API */ | ||
public static final Setting<Boolean> FLOW_FRAMEWORK_ENABLED = Setting.boolSetting( | ||
"plugins.flow_framework.enabled", | ||
false, | ||
Setting.Property.NodeScope, | ||
Setting.Property.Dynamic | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/org/opensearch/flowframework/rest/AbstractWorkflowAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.flowframework.rest; | ||
|
||
import org.opensearch.cluster.service.ClusterService; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.common.unit.TimeValue; | ||
import org.opensearch.rest.BaseRestHandler; | ||
|
||
import static org.opensearch.flowframework.common.FlowFrameworkSettings.MAX_WORKFLOWS; | ||
import static org.opensearch.flowframework.common.FlowFrameworkSettings.WORKFLOW_REQUEST_TIMEOUT; | ||
|
||
/** | ||
* Abstract action for the rest actions | ||
*/ | ||
public abstract class AbstractWorkflowAction extends BaseRestHandler { | ||
/** Timeout for the request*/ | ||
protected volatile TimeValue requestTimeout; | ||
/** Max workflows that can be created*/ | ||
protected volatile Integer maxWorkflows; | ||
|
||
/** | ||
* Instantiates a new AbstractWorkflowAction | ||
* | ||
* @param settings Environment settings | ||
* @param clusterService clusterService | ||
*/ | ||
public AbstractWorkflowAction(Settings settings, ClusterService clusterService) { | ||
this.requestTimeout = WORKFLOW_REQUEST_TIMEOUT.get(settings); | ||
this.maxWorkflows = MAX_WORKFLOWS.get(settings); | ||
|
||
clusterService.getClusterSettings().addSettingsUpdateConsumer(WORKFLOW_REQUEST_TIMEOUT, it -> requestTimeout = it); | ||
clusterService.getClusterSettings().addSettingsUpdateConsumer(MAX_WORKFLOWS, it -> maxWorkflows = it); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.