Code Monkey home page Code Monkey logo

taskhuddler's Introduction

A higher level wrapper around taskcluster-client.py with the aim of having a more Pythonic interface to taskcluster.

Currently aiming to get easier, read-only features available.

Installation

pip install taskhuddler

For further data analysis, add the optional Pandas dependency

pip install taskhuddler[pandas]

Examining a Task Group

from taskhuddler import TaskGraph

# All tasks will be cached in memory when TaskGraph is called
# But this means data may get stale.
graph = TaskGraph('M5hSue6oRSu_klunMRHolg')
for task in graph.tasks():
    print(task.taskId)
# Fetch the set of tasks again.
graph.fetch_tasks()

# On-disk caching:
os.environ['TC_CACHE_DIR'] = '/tmp/cache/'
# All future TaskGraph calls from now on will write the
# json to TC_CACHE_DIR and will avoid a call to taskcluster


# Are all the tasks in the 'completed' state?
print(graph.completed)

if graph.completed:
    started = graph.earliest_start_time
    finished = graph.latest_finished_time
    print("Graph took {} to run".format(finished-started))

Examining Tasks

TaskDefinition, TaskStatus and Task are all available to work with tasks. A Task is a wrapper around a TaskDefinition and a TaskStatus.

The Task class populates both a TaskStatus and TaskDefinition, each of which can be used by themselves

from taskhuddler import Task, TaskDefinition, TaskStatus
from dataclasses import asdict

mytask = Task.from_task_id('M5hSue6oRSu_klunMRHolg')
print(task.status.state)

print(asdict(task))

my_task_def = TaskDefinition.from_task_id('M5hSue6oRSu_klunMRHolg')
my_task_def = TaskDefinition.from_dict(mytask.task)

my_task_status = TaskStatus.from_task_id('M5hSue6oRSu_klunMRHolg')
my_task_status = TaskStatus.from_dict(mytask.status)

Pandas

With pip install taskhuddler[pandas] the to_datetime method becomes available, returning a Pandas DataFrame with task and run data:

from taskhuddler import TaskGraph

graph = TaskGraph('M5hSue6oRSu_klunMRHolg')

df = graph.to_dataframe()

Plans

  • Reduce the per-query limit for cached graphs so the initial response is quicker

taskhuddler's People

Contributors

bhearsum avatar escapewindow avatar mozilla-github-standards avatar nthomas-mozilla avatar srfraser avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taskhuddler's Issues

CODE_OF_CONDUCT.md file missing

As of January 1 2019, Mozilla requires that all GitHub projects include this CODE_OF_CONDUCT.md file in the project root. The file has two parts:

  1. Required Text - All text under the headings Community Participation Guidelines and How to Report, are required, and should not be altered.
  2. Optional Text - The Project Specific Etiquette heading provides a space to speak more specifically about ways people can work effectively and inclusively together. Some examples of those can be found on the Firefox Debugger project, and Common Voice. (The optional part is commented out in the raw template file, and will not be visible until you modify and uncomment that part.)

If you have any questions about this file, or Code of Conduct policies and procedures, please reach out to [email protected].

(Message COC001)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.