<commit_before>package com.breakersoft.plow.thrift;

import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.breakersoft.plow.event.JobLaunchEvent;
import com.breakersoft.plow.service.JobService;
import com.breakersoft.plow.service.StateManager;
import com.breakersoft.plow.thrift.dao.ThriftJobDao;
import com.breakersoft.plow.thrift.dao.ThriftLayerDao;
import com.breakersoft.plow.thrift.dao.ThriftNodeDao;
import com.breakersoft.plow.thrift.dao.ThriftTaskDao;

@ThriftService
public class RpcThriftServiceImpl implements RpcService.Iface {

    private Logger logger = org.slf4j.LoggerFactory.getLogger(RpcThriftServiceImpl.class);

    @Autowired
    JobService jobService;

    @Autowired
    ThriftJobDao thriftJobDao;

    @Autowired
    ThriftLayerDao thriftLayerDao;

    @Autowired
    ThriftTaskDao thriftTaskDao;

    @Autowired
    ThriftNodeDao thriftNodeDao;

    @Autowired
    StateManager stateManager;

    @Override
    public JobT launch(JobSpecT spec) throws PlowException, TException {

        logger.info("launchung job: {} ", spec);

        JobLaunchEvent event =  jobService.launch(spec);

        JobT result = new JobT();
        result.id = event.getJob().getJobId().toString();
        result.name = event.getJobSpec().getName();
        return result;
    }

    @Override
    public JobT getActiveJob(String name) throws PlowException, TException {
        return thriftJobDao.getRunningJob(name);
    }

    @Override
    public JobT getJob(String jobId) throws PlowException, TException {
        return thriftJobDao.getJob(jobId);
    }

    @Override
    public LayerT getLayerById(String id) throws PlowException, TException {
        return thriftLayerDao.getLayer(UUID.fromString(id));
    }

    @Override
    public List<LayerT> getLayers(String jobId) throws PlowException, TException {
        return thriftLayerDao.getLayers(UUID.fromString(jobId));
    }

    @Override
    public TaskT getTask(String id) throws PlowException, TException {
        return thriftTaskDao.getTask(UUID.fromString(id));
    }

    @Override
    public List<TaskT> getTasks(TaskFilterT filter) throws PlowException, TException {
        return thriftTaskDao.getTasks(filter);
    }

    @Override
    public List<JobT> getJobs(JobFilterT filter) throws PlowException, TException {
        return thriftJobDao.getJobs(filter);
    }

    @Override
    public boolean killJob(String jobId, String reason) throws PlowException, TException {
        return stateManager.killJob(jobService.getJob(jobId), reason);
    }

    @Override
    public NodeT getNode(String id) throws PlowException, TException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public List<NodeT> getNodes(NodeFilterT filter) throws PlowException,
            TException {
        return thriftNodeDao.getNodes(filter);
    }

    @Override
    public void pauseJob(String id, boolean value) throws PlowException,
            TException {
        jobService.setJobPaused(jobService.getJob(id), value);
    }

    @Override
    public List<OutputT> getJobOutputs(String jobId) throws PlowException,
            TException {
        return thriftJobDao.getOutputs(UUID.fromString(jobId));
    }

    @Override
    public List<OutputT> getLayerOutputs(String layerId) throws PlowException,
            TException {
        return thriftLayerDao.getOutputs(UUID.fromString(layerId));
    }
<commit_msg>Updated getNode to call into DAO.<commit_after>package com.breakersoft.plow.thrift;

import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.breakersoft.plow.event.JobLaunchEvent;
import com.breakersoft.plow.service.JobService;
import com.breakersoft.plow.service.StateManager;
import com.breakersoft.plow.thrift.dao.ThriftJobDao;
import com.breakersoft.plow.thrift.dao.ThriftLayerDao;
import com.breakersoft.plow.thrift.dao.ThriftNodeDao;
import com.breakersoft.plow.thrift.dao.ThriftTaskDao;

@ThriftService
public class RpcThriftServiceImpl implements RpcService.Iface {

    private Logger logger = org.slf4j.LoggerFactory.getLogger(RpcThriftServiceImpl.class);

    @Autowired
    JobService jobService;

    @Autowired
    ThriftJobDao thriftJobDao;

    @Autowired
    ThriftLayerDao thriftLayerDao;

    @Autowired
    ThriftTaskDao thriftTaskDao;

    @Autowired
    ThriftNodeDao thriftNodeDao;

    @Autowired
    StateManager stateManager;

    @Override
    public JobT launch(JobSpecT spec) throws PlowException, TException {

        logger.info("launchung job: {} ", spec);

        JobLaunchEvent event =  jobService.launch(spec);

        JobT result = new JobT();
        result.id = event.getJob().getJobId().toString();
        result.name = event.getJobSpec().getName();
        return result;
    }

    @Override
    public JobT getActiveJob(String name) throws PlowException, TException {
        return thriftJobDao.getRunningJob(name);
    }

    @Override
    public JobT getJob(String jobId) throws PlowException, TException {
        return thriftJobDao.getJob(jobId);
    }

    @Override
    public LayerT getLayerById(String id) throws PlowException, TException {
        return thriftLayerDao.getLayer(UUID.fromString(id));
    }

    @Override
    public List<LayerT> getLayers(String jobId) throws PlowException, TException {
        return thriftLayerDao.getLayers(UUID.fromString(jobId));
    }

    @Override
    public TaskT getTask(String id) throws PlowException, TException {
        return thriftTaskDao.getTask(UUID.fromString(id));
    }

    @Override
    public List<TaskT> getTasks(TaskFilterT filter) throws PlowException, TException {
        return thriftTaskDao.getTasks(filter);
    }

    @Override
    public List<JobT> getJobs(JobFilterT filter) throws PlowException, TException {
        return thriftJobDao.getJobs(filter);
    }

    @Override
    public boolean killJob(String jobId, String reason) throws PlowException, TException {
        return stateManager.killJob(jobService.getJob(jobId), reason);
    }

    @Override
    public NodeT getNode(String id) throws PlowException, TException {
        return thriftNodeDao.getNode(UUID.fromString(id));
    }

    @Override
    public List<NodeT> getNodes(NodeFilterT filter) throws PlowException,
            TException {
        return thriftNodeDao.getNodes(filter);
    }

    @Override
    public void pauseJob(String id, boolean value) throws PlowException,
            TException {
        jobService.setJobPaused(jobService.getJob(id), value);
    }

    @Override
    public List<OutputT> getJobOutputs(String jobId) throws PlowException,
            TException {
        return thriftJobDao.getOutputs(UUID.fromString(jobId));
    }

    @Override
    public List<OutputT> getLayerOutputs(String layerId) throws PlowException,
            TException {
        return thriftLayerDao.getOutputs(UUID.fromString(layerId));
    }

{'fraction_non_alphanumeric': 0.08545581071677105, 'fraction_numerical': 0.0005567153792623522, 'mean_word_length': 3.5109855618330195, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1696511', 'n_tokens_mistral': 2177, 'n_tokens_neox': 2223, 'n_words': 439}