Exemplo n.º 1
0
 def get_tasks(self, jobid, **filters):
   return TaskList.select(self.jt,
                          jobid,
                          filters['task_types'],
                          filters['task_states'],
                          filters['task_text'],
                          _DEFAULT_OBJ_PER_PAGINATION,
                          _DEFAULT_OBJ_PER_PAGINATION * (filters['pagenum'] - 1))
Exemplo n.º 2
0
 def get_tasks(self, jobid, **filters):
   return TaskList.select(self.jt,
                          jobid,
                          filters['task_types'],
                          filters['task_states'],
                          filters['task_text'],
                          _DEFAULT_OBJ_PER_PAGINATION,
                          _DEFAULT_OBJ_PER_PAGINATION * (filters['pagenum'] - 1))
Exemplo n.º 3
0
def tasks(request, jobid):
    """
  We get here from /jobs/jobid/tasks?filterargs, with the options being:
    page=<n>            - Controls pagination. Defaults to 1.
    tasktype=<type>     - Type can be one of hadoop.job_tracker.VALID_TASK_TYPES
                          ("map", "reduce", "job_cleanup", "job_setup")
    taskstate=<state>   - State can be one of hadoop.job_tracker.VALID_TASK_STATES
                          ("succeeded", "failed", "running", "pending", "killed")
    tasktext=<text>     - Where <text> is a string matching info on the task
  """
    # Get the filter parameters
    ttypes = request.GET.get("tasktype")
    tstates = request.GET.get("taskstate")
    ttext = request.GET.get("tasktext")
    task_types = None
    if ttypes:
        task_types = set(ttypes.split(","))
    task_states = None
    if tstates:
        task_states = set(tstates.split(","))

    pagenum = int(request.GET.get("page", 1))
    if pagenum < 0:
        pagenum = 1

    # Fetch the list of tasks
    task_list = TaskList.select(
        request.jt,
        jobid,
        task_types,
        task_states,
        ttext,
        __DEFAULT_OBJ_PER_PAGINATION,
        __DEFAULT_OBJ_PER_PAGINATION * (pagenum - 1),
    )

    paginator = Paginator(task_list, __DEFAULT_OBJ_PER_PAGINATION, total=task_list.numTotalTasks)
    page = paginator.page(pagenum)

    # We need to pass the parameters back to the template to generate links
    filter_params = copy_query_dict(request.GET, ("tasktype", "taskstate", "tasktext")).urlencode()

    return render(
        "tasks.mako",
        request,
        {
            "request": request,
            "filter_params": filter_params,
            "jobid": jobid,
            "jobid_short": get_shorter_id(jobid),
            "page": page,
            "tasktype": ttypes,
            "taskstate": tstates,
            "tasktext": ttext,
        },
    )
Exemplo n.º 4
0
def tasks(request, jobid):
    """
  We get here from /jobs/jobid/tasks?filterargs, with the options being:
    page=<n>            - Controls pagination. Defaults to 1.
    tasktype=<type>     - Type can be one of hadoop.job_tracker.VALID_TASK_TYPES
                          ("map", "reduce", "job_cleanup", "job_setup")
    taskstate=<state>   - State can be one of hadoop.job_tracker.VALID_TASK_STATES
                          ("succeeded", "failed", "running", "pending", "killed")
    tasktext=<text>     - Where <text> is a string matching info on the task
  """
    # Get the filter parameters
    ttypes = request.GET.get('tasktype')
    tstates = request.GET.get('taskstate')
    ttext = request.GET.get('tasktext')
    task_types = None
    if ttypes:
        task_types = set(ttypes.split(','))
    task_states = None
    if tstates:
        task_states = set(tstates.split(','))

    pagenum = int(request.GET.get('page', 1))
    if pagenum < 0:
        pagenum = 1

    # Fetch the list of tasks
    task_list = TaskList.select(request.jt, jobid, task_types, task_states,
                                ttext, __DEFAULT_OBJ_PER_PAGINATION,
                                __DEFAULT_OBJ_PER_PAGINATION * (pagenum - 1))

    paginator = Paginator(task_list,
                          __DEFAULT_OBJ_PER_PAGINATION,
                          total=task_list.numTotalTasks)
    page = paginator.page(pagenum)

    # We need to pass the parameters back to the template to generate links
    filter_params = copy_query_dict(
        request.GET, ('tasktype', 'taskstate', 'tasktext')).urlencode()

    return render(
        "tasks.mako", request, {
            'request': request,
            'filter_params': filter_params,
            'jobid': jobid,
            'page': page,
            'tasktype': ttypes,
            'taskstate': tstates,
            'tasktext': ttext
        })