Search in sources :

Example 16 with PollData

use of com.netflix.conductor.common.metadata.tasks.PollData in project conductor by Netflix.

the class RedisPollDataDAO method updateLastPollData.

@Override
public void updateLastPollData(String taskDefName, String domain, String workerId) {
    Preconditions.checkNotNull(taskDefName, "taskDefName name cannot be null");
    PollData pollData = new PollData(taskDefName, domain, workerId, System.currentTimeMillis());
    String key = nsKey(POLL_DATA, pollData.getQueueName());
    String field = (domain == null) ? "DEFAULT" : domain;
    String payload = toJson(pollData);
    recordRedisDaoRequests("updatePollData");
    recordRedisDaoPayloadSize("updatePollData", payload.length(), "n/a", "n/a");
    dynoClient.hset(key, field, payload);
}
Also used : PollData(com.netflix.conductor.common.metadata.tasks.PollData)

Example 17 with PollData

use of com.netflix.conductor.common.metadata.tasks.PollData in project conductor by Netflix.

the class RedisPollDataDAO method getPollData.

@Override
public PollData getPollData(String taskDefName, String domain) {
    Preconditions.checkNotNull(taskDefName, "taskDefName name cannot be null");
    String key = nsKey(POLL_DATA, taskDefName);
    String field = (domain == null) ? "DEFAULT" : domain;
    String pollDataJsonString = dynoClient.hget(key, field);
    recordRedisDaoRequests("getPollData");
    recordRedisDaoPayloadSize("getPollData", StringUtils.length(pollDataJsonString), "n/a", "n/a");
    PollData pollData = null;
    if (StringUtils.isNotBlank(pollDataJsonString)) {
        pollData = readValue(pollDataJsonString, PollData.class);
    }
    return pollData;
}
Also used : PollData(com.netflix.conductor.common.metadata.tasks.PollData)

Aggregations

PollData (com.netflix.conductor.common.metadata.tasks.PollData)17 Test (org.junit.Test)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 Task (com.netflix.conductor.common.metadata.tasks.Task)4 WorkflowTask (com.netflix.conductor.common.metadata.workflow.WorkflowTask)4 Workflow (com.netflix.conductor.common.run.Workflow)4 SubWorkflow (com.netflix.conductor.core.execution.tasks.SubWorkflow)4 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)3 WorkflowSystemTask (com.netflix.conductor.core.execution.tasks.WorkflowSystemTask)3 HashMap (java.util.HashMap)3 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)1 Status (com.netflix.conductor.common.metadata.tasks.Task.Status)1 COMPLETED (com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED)1 COMPLETED_WITH_ERRORS (com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED_WITH_ERRORS)1 FAILED (com.netflix.conductor.common.metadata.tasks.Task.Status.FAILED)1 IN_PROGRESS (com.netflix.conductor.common.metadata.tasks.Task.Status.IN_PROGRESS)1 SCHEDULED (com.netflix.conductor.common.metadata.tasks.Task.Status.SCHEDULED)1