List of usage examples for com.amazonaws.services.simpleworkflow.model ExecutionTimeFilter ExecutionTimeFilter
ExecutionTimeFilter
From source file:org.diksha.common.dyutils.SchedulerUDE.java
License:Apache License
public void listStatus(String clientId, SchedulerConfig schedulerConfig) { DynamoDBMapper mapper = DyDBUtils.getDynamoDBMapper(); SchedulerWorkflowState schedulerWorkflowState = mapper.load(SchedulerWorkflowState.class, clientId); System.out.println("clientID : " + clientId); System.out.println(" Launch Parameters"); System.out/*from w w w .j ava 2 s. c om*/ .println(" Function: (" + this.functionName + ") with context = " + this.functionContext); System.out.println(" CronExpression : " + this.cronExpression); System.out.println(" RepeatTimes : " + this.repeatTimes); System.out.println(" StartTimeDate : " + this.startTimeDate); System.out.println(" EndTimeDate : " + this.endTimeDate); System.out.println(" Current State"); int cnt = schedulerWorkflowState.loopCount - 1; System.out.println(" status of loop : " + schedulerWorkflowState.getLoopState()); System.out.println(" # of times executed : " + cnt); System.out.println(" Last Executed @ : " + schedulerWorkflowState.lastExecutionTimeDate); System.out.println(" Next Proposed Time @ : " + schedulerWorkflowState.lastProposedTimeDate); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient( DyDBUtils.getAwsCredentials()); amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint()); ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest = new ListOpenWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()) .withExecutionFilter(new WorkflowExecutionFilter().withWorkflowId(clientId)) .withReverseOrder(new Boolean("true")) .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionInfos openWorkflowExecutionInfos = amazonSimpleWorkflowClient .listOpenWorkflowExecutions(listOpenWorkflowExecutionsRequest); List<WorkflowExecutionInfo> listOpenWorkflowExecutionInfo = openWorkflowExecutionInfos.getExecutionInfos(); ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest = new ListClosedWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()) .withExecutionFilter(new WorkflowExecutionFilter().withWorkflowId(clientId)) .withReverseOrder(new Boolean("true")) .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionInfos closedWorkflowExecutionInfos = amazonSimpleWorkflowClient .listClosedWorkflowExecutions(listClosedWorkflowExecutionsRequest); List<WorkflowExecutionInfo> listClosedWorkflowExecutionInfo = closedWorkflowExecutionInfos .getExecutionInfos(); listActivitiesInWEI(schedulerConfig, listOpenWorkflowExecutionInfo); listActivitiesInWEI(schedulerConfig, listClosedWorkflowExecutionInfo); System.out.println("\n"); }
From source file:org.diksha.common.dyutils.SchedulerUDE.java
License:Apache License
public static int countOpenExecutionsFromSWF(String config) { SchedulerConfig schedulerConfig = DyDBUtils.getSchedulerConfig(config); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient( DyDBUtils.getAwsCredentials()); amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint()); CountOpenWorkflowExecutionsRequest countOpenWorkflowExecutionsRequest = new CountOpenWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()); countOpenWorkflowExecutionsRequest// ww w .j a va 2 s .c om .setStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionCount workflowExecutionCount = amazonSimpleWorkflowClient .countOpenWorkflowExecutions(countOpenWorkflowExecutionsRequest); return workflowExecutionCount.getCount(); }
From source file:org.diksha.common.dyutils.SchedulerUDE.java
License:Apache License
public static ArrayList<String> listOpenExecutionsFromSWF(String config) { ArrayList<String> retValue = new ArrayList<String>(); SchedulerConfig schedulerConfig = DyDBUtils.getSchedulerConfig(config); AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient( DyDBUtils.getAwsCredentials()); amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint()); ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest = new ListOpenWorkflowExecutionsRequest() .withDomain(schedulerConfig.getDomain()) .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L))); WorkflowExecutionInfos workflowExecutionInfos = amazonSimpleWorkflowClient .listOpenWorkflowExecutions(listOpenWorkflowExecutionsRequest); String nextPageToken;/*from w w w . java 2 s .c om*/ do { java.util.List<WorkflowExecutionInfo> listWorkflowExecutionInfos = workflowExecutionInfos .getExecutionInfos(); for (int cnt = 0; cnt < listWorkflowExecutionInfos.size(); cnt++) { retValue.add(listWorkflowExecutionInfos.get(cnt).getExecution().getWorkflowId()); } nextPageToken = workflowExecutionInfos.getNextPageToken(); } while (nextPageToken != null); return retValue; }