Skip to content

Commit ade3856

Browse files
committed
#135 Adding task for waiting for the task server
1 parent 1c28dbe commit ade3856

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ dependencies {
3232
compile localGroovy()
3333
compile mlAppDeployerDependency
3434
compile mlcpUtilDependency
35-
compile "com.marklogic:ml-javaclient-util:2.10.0-alpha"
3635
}
3736

3837
task sourcesJar(type: Jar, dependsOn: classes) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=com.marklogic
22
version=2.4.0-dev
3-
mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.3.1
3+
mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.4.0
44
mlcpUtilDependency=com.marklogic:mlcp-util:0.3.0
55

src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.marklogic.appdeployer.command.forests.DeployCustomForestsCommand
55
import com.marklogic.gradle.task.forests.DeployCustomForestsTask
66
import com.marklogic.gradle.task.qconsole.ExportWorkspacesTask
77
import com.marklogic.gradle.task.qconsole.ImportWorkspacesTask
8+
import com.marklogic.gradle.task.tasks.WaitForTaskServerTask
89
import com.sun.jersey.core.spi.component.ProviderServices
910
import org.gradle.api.Plugin
1011
import org.gradle.api.Project
@@ -246,7 +247,8 @@ class MarkLogicPlugin implements Plugin<Project> {
246247
project.task("mlDeleteAllTasks", type: DeleteAllTasksTask, group: taskGroup, description: "Delete all scheduled tasks in the cluster")
247248
project.task("mlDeployTasks", type: DeployTasksTask, group: taskGroup, description: "Deploy each scheduled task, updating it if it exists, in the configuration directory")
248249
project.task("mlUndeployTasks", type: UndeployTasksTask, group: taskGroup, description: "Undeploy (delete) each scheduled task in the configuration directory")
249-
250+
project.task("mlWaitForTaskServer", type: WaitForTaskServerTask, group: taskGroup, description: "Wait for the task server to not have any requests in progress")
251+
250252
String triggerGroup = "ml-gradle Trigger"
251253
project.task("mlDeployTriggers", type: DeployTriggersTask, group: triggerGroup, description: "Deploy each trigger, updating it if it exists, in the configuration directory")
252254

src/main/groovy/com/marklogic/gradle/task/databases/ClearSchemasDatabaseTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.marklogic.mgmt.databases.DatabaseManager
88
class ClearSchemasDatabaseTask extends MarkLogicTask {
99

1010
@TaskAction
11-
void clearModules() {
11+
void clearSchemasDatabase() {
1212
println "Clearing all documents in schemas database"
1313
DatabaseManager mgr = new DatabaseManager(getManageClient())
1414
mgr.clearDatabase(getAppConfig().getSchemasDatabaseName())
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.marklogic.gradle.task.tasks
2+
3+
import com.marklogic.appdeployer.command.tasks.WaitForTaskServerCommand
4+
import com.marklogic.gradle.task.MarkLogicTask
5+
import org.gradle.api.tasks.TaskAction
6+
7+
/**
8+
* Waits until the task server has no requests in progress.
9+
*/
10+
class WaitForTaskServerTask extends MarkLogicTask {
11+
12+
String groupName
13+
int retryInSeconds = 0
14+
15+
@TaskAction
16+
void waitForTaskServer() {
17+
WaitForTaskServerCommand c = new WaitForTaskServerCommand()
18+
if (groupName != null) {
19+
c.setGroupName(groupName)
20+
}
21+
if (retryInSeconds > 0) {
22+
c.setRetryInSeconds(retryInSeconds)
23+
}
24+
c.execute(getCommandContext())
25+
}
26+
}

0 commit comments

Comments
 (0)