MCPcopy Index your code
hub / github.com/diffgram/diffgram / Task

Class Task

shared/database/task/task.py:30–943  ·  view source on GitHub ↗

A single unit of work. A task is part of a graph of tasks Each task has files that may be done multiple times We can "denormalize" links later, but for now want to use data structure [ ] Differences for different types, ie semantic segmentation?

Source from the content-addressed store, hash-verified

28
29
30class Task(Base):
31 """
32 A single unit of work.
33
34 A task is part of a graph of tasks
35 Each task has files that may be done multiple times
36 We can "denormalize" links later, but for now want to use data structure
37
38 [ ] Differences for different types, ie semantic segmentation?
39
40 """
41
42 __tablename__ = 'task'
43 id = Column(BIGINT, primary_key = True)
44
45 is_live = Column(Boolean, default = True)
46
47 # NEW
48 """
49 template_id = Column(Integer, ForeignKey('task_template.id'))
50 template = relationship( "Task_Template",
51 uselist=False,
52 foreign_keys=[template_id])
53 """
54 # NEW
55
56 is_root = Column(Boolean)
57 root_id = Column(Integer, ForeignKey('task.id'))
58
59 def root(self, session):
60 return Task.get_by_id(session, self.root_id)
61
62 """
63 root = relationship("Task",
64 uselist=False,
65 foreign_keys=[root_id],
66 cascade="all, delete-orphan",
67 post_update=True)
68 """
69
70 parent_id = Column(Integer, ForeignKey('task.id'))
71
72 def parent(self, session):
73 return Task.get_by_id(session, self.parent_id)
74
75 """
76 parent = relationship("Task",
77 uselist=False,
78 foreign_keys=[parent_id],
79 cascade="all, delete-orphan",
80 post_update=True) # only 1 parent? so uselist=False
81 """
82
83 def child_list(self, session):
84 return session.query(Task).filter(
85 Task.parent_id == self.id).all()
86
87 # Not sure if we need this...

Callers 2

create_taskFunction · 0.90
newMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected