コード例 #1
0
ファイル: Query.java プロジェクト: hyunsik/incubator-tajo
  public Query(
      final QueryMasterTask.QueryMasterTaskContext context,
      final QueryId id,
      final long appSubmitTime,
      final String queryStr,
      final EventHandler eventHandler,
      final MasterPlan plan) {
    this.context = context;
    this.systemConf = context.getConf();
    this.id = id;
    this.clock = context.getClock();
    this.appSubmitTime = appSubmitTime;
    this.queryStr = queryStr;
    subqueries = Maps.newHashMap();
    this.eventHandler = eventHandler;
    this.plan = plan;
    this.sm = context.getStorageManager();
    cursor = new ExecutionBlockCursor(plan);

    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    this.readLock = readWriteLock.readLock();
    this.writeLock = readWriteLock.writeLock();

    stateMachine = stateMachineFactory.make(this);
  }
コード例 #2
0
  public TaskImpl(
      TezVertexID vertexId,
      int taskIndex,
      EventHandler eventHandler,
      Configuration conf,
      TaskAttemptListener taskAttemptListener,
      Clock clock,
      TaskHeartbeatHandler thh,
      AppContext appContext,
      boolean leafVertex,
      TaskLocationHint locationHint,
      Resource resource,
      ContainerContext containerContext) {
    this.conf = conf;
    this.clock = clock;
    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    readLock = readWriteLock.readLock();
    writeLock = readWriteLock.writeLock();
    this.attempts = Collections.emptyMap();
    maxAttempts =
        this.conf.getInt(
            TezConfiguration.TEZ_AM_MAX_TASK_ATTEMPTS,
            TezConfiguration.TEZ_AM_MAX_TASK_ATTEMPTS_DEFAULT);
    taskId = new TezTaskID(vertexId, taskIndex);
    this.taskAttemptListener = taskAttemptListener;
    this.taskHeartbeatHandler = thh;
    this.eventHandler = eventHandler;
    this.appContext = appContext;

    this.leafVertex = leafVertex;
    this.locationHint = locationHint;
    this.taskResource = resource;
    this.containerContext = containerContext;
    stateMachine = stateMachineFactory.make(this);
  }
コード例 #3
0
    public StubbedJob(
        JobId jobId,
        ApplicationAttemptId applicationAttemptId,
        Configuration conf,
        EventHandler eventHandler,
        boolean newApiCommitter,
        String user,
        int numSplits,
        AppContext appContext) {
      super(
          jobId,
          applicationAttemptId,
          conf,
          eventHandler,
          null,
          new JobTokenSecretManager(),
          new Credentials(),
          new SystemClock(),
          Collections.<TaskId, TaskInfo>emptyMap(),
          MRAppMetrics.create(),
          null,
          newApiCommitter,
          user,
          System.currentTimeMillis(),
          null,
          appContext,
          null,
          null);

      initTransition = getInitTransition(numSplits);
      localFactory =
          stateMachineFactory.addTransition(
              JobStateInternal.NEW,
              EnumSet.of(JobStateInternal.INITED, JobStateInternal.FAILED),
              JobEventType.JOB_INIT,
              // This is abusive.
              initTransition);

      // This "this leak" is okay because the retained pointer is in an
      //  instance variable.
      localStateMachine = localFactory.make(this);
    }