Esempio n. 1
0
def event(start, end):
    gap = 1000
    for i in range(start, end):
        task = DMTask()
        val = {"name": "get_events", "action_type": "loop", "start": i * gap, "end": (i + 1) * gap}
        task.init("github", val)
        r1 = GithubEvent(task)
        r1.runTask()
Esempio n. 2
0
def import_event(start, end):
    gap = 1000
    for i in range(start, end):
        task = DMTask()
        val = {"name": "get_events", "action_type": "loop", "start": i * gap, "end": (i + 1) * gap}
        task.init("github", val)
        r1 = GithubEvent(task)
        file = "./TaskFinishedFiles/get_events_start_" + str(i * gap) + ".output"
        r1.runTaskFromFile(file)
Esempio n. 3
0
def gen_event(start, end):
    gap = 1000
    for i in range(start, end):
        task = DMTask()
        val = {"name": "get_events", "action_type": "loop", "start": i * gap, "end": (i + 1) * gap}
        task.init("github", val)
        r1 = GithubEvent(task)
        file = "./TaskFiles/get_events_start_" + str(i * gap)
        r1.generateToFile(file)
Esempio n. 4
0
def event(start, end):
    gap = 1000
    for i in range(start, end):
        task = DMTask()
        val = {
            "name": "get_events",
            "action_type": "loop",
            "start": i * gap,
            "end": (i + 1) * gap
        }
        task.init("github", val)
        r1 = GithubEvent(task)
        r1.runTask()
Esempio n. 5
0
def gen_event(start, end):
    gap = 1000
    for i in range(start, end):
        task = DMTask()
        val = {
            "name": "get_events",
            "action_type": "loop",
            "start": i * gap,
            "end": (i + 1) * gap
        }
        task.init("github", val)
        r1 = GithubEvent(task)
        file = "./TaskFiles/get_events_start_" + str(i * gap)
        r1.generateToFile(file)
Esempio n. 6
0
def import_event(start, end):
    gap = 1000
    for i in range(start, end):
        task = DMTask()
        val = {
            "name": "get_events",
            "action_type": "loop",
            "start": i * gap,
            "end": (i + 1) * gap
        }
        task.init("github", val)
        r1 = GithubEvent(task)
        file = "./TaskFinishedFiles/get_events_start_" + str(
            i * gap) + ".output"
        r1.runTaskFromFile(file)
Esempio n. 7
0
    def set(self, action_type, cmd, start, end):
        self.task = DMTask()
        self.r = None
        self.val = {"action_type": action_type, "start": start, "end": end}
        if cmd == "get_repos":
            self.val["name"] = "get_repos"
            self.task.init("github", self.val)
            self.r = GithubRepo(self.task)
        elif cmd == "get_followers":
            self.val["name"] = "get_followers"
            self.task.init("github", self.val)
            self.r = GithubFollowers(self.task)
        elif cmd == "get_events":
            self.val["name"] = "get_events"
            self.task.init("github", self.val)
            self.r = GithubEvent(self.task)


# TODO: do not support now
        elif cmd == "get_users":
            self.val["name"] = "get_users"
            self.task.init("github", self.val)
            self.r = GithubUser(self.task)
        elif cmd == "get_repositories":
            self.val["name"] = "get_repositories"
            self.task.init("github", self.val)
            self.r = GithubRepositories(self.task)
        elif cmd == "get_contributors":
            self.val["name"] = "get_contributors"
            self.task.init("github", self.val)
            self.r = GithubContributors(self.task)
        elif cmd == "get_commit":
            self.val["name"] = "get_commit"
            self.task.init("github", self.val)
            self.r = GithubCommit(self.task)
        elif cmd == "get_commit_p1":
            self.val["name"] = "get_commit_p1"
            self.task.init("github", self.val)
            self.r = GithubCommit(self.task)
        else:
            print "Failed to init the task"
            return 0
        return 1