当前位置: 首页>>代码示例>>Python>>正文


Python Task.filter_task_by_time方法代码示例

本文整理汇总了Python中Task.Task.filter_task_by_time方法的典型用法代码示例。如果您正苦于以下问题:Python Task.filter_task_by_time方法的具体用法?Python Task.filter_task_by_time怎么用?Python Task.filter_task_by_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Task.Task的用法示例。


在下文中一共展示了Task.filter_task_by_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_plot_file

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import filter_task_by_time [as 别名]
	def generate_plot_file(self):

			'''
			Step One: analyse the build task
			'''
			#filter tasks by given type wanted
			#build_tasks_unsorted = Task.filter_task_in_by_type(self._build_tasks_all,self.task_type)
			
			#get a task list that cost max time cost
			task_list = TaskDependency.create_critical_dependency_line(self._build_tasks_all, self._build_task_dependencies)
			'''
			Step Two: filter tasks and sort tasks
			'''
			time_threshold = max(1.0, self._timefilter ) # time threshold must be at least 1.0 second
			#filter tasks by given time_threshold
			build_tasks_unsorted = Task.filter_task_by_time(self._build_tasks_all,time_threshold,task_list)
			#sort it with time start
			build_tasks = sorted(build_tasks_unsorted, key=lambda build_task: build_task.start)
			'''
			Step Three: draw the build task
			'''
			# Collect task type and task name from build tasks
			task_types, task_names = self.make_task_names_and_types(build_tasks)
			# Set color for each task type
			color_task = self.make_task_color(task_types)
			# Set indices to tasks
			task_map = dict(itertools.izip(task_names, itertools.count(1)))
			# Make task_rectangles in the coordinates axis
			(task_rectangles,task_arrows) = self.make_task_rectangles_and_dependency_path(build_tasks,task_list, task_map, color_task)
			# Make Task label between  task_rectangle in the coordinates axis
			task_labels = self.make_labels(build_tasks, task_map)
		   
			# Generate png gnuplot commands
			plot_png = self.generate_plot_png(self._png_file,len(task_rectangles) * self._single_task_row_height)
			plot_coord = self.generate_plot_coord(self._title, build_tasks, task_names, task_map)
			plot_rectangles = self.generate_plot_rectangle(task_rectangles)
			plot_arrows = self.generate_plot_arrow(task_arrows)
			plot_labels = self.generate_plot_label(task_labels)
			plot_lines = self.generate_plot_line()
			plot_output = self.generate_plot_output()
			# Save plot file and generate png 
			return self.save_file(self._outputfile,plot_png, plot_coord, plot_rectangles, plot_arrows, plot_labels, plot_lines,plot_output)
开发者ID:Yosoatroad,项目名称:tool-gantt-chart,代码行数:44,代码来源:GNUPlotGenerator.py


注:本文中的Task.Task.filter_task_by_time方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。