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

Function root_task_new

shared/utils/task/task_new.py:45–107  ·  view source on GitHub ↗

Create a new root task Depending on conditions ... Should we always consider the root task to be a "system" level task? or is that unnessary... don't want to over complicate it How do we know which root tasks have been created / files addressed? Unless we somehow track th

(session,
                  job,
                  file,
                  guide_id)

Source from the content-addressed store, hash-verified

43
44
45def root_task_new(session,
46 job,
47 file,
48 guide_id):
49 """
50 Create a new root task
51
52 Depending on conditions ...
53
54 Should we always consider the root task to be a "system" level task?
55 or is that unnessary... don't want to over complicate it
56
57 How do we know which root tasks have been created / files addressed?
58 Unless we somehow track that? Maybe are we better off just creating all
59 the root tasks upfront?
60
61 Do we create the review tasks upfront? or does that simply
62 get done "one demand" ie a flag to crete a new xyz task upon completion...
63 or maybe both...
64
65 future looking at a
66 job.copy_instance_list
67
68 because "copying" a video file requires new sequence creation
69
70 And also this may be something we want as "feature"
71
72 """
73 if job.file_handling == "isolate" or job.type == 'exam_template' or job.type == 'examination':
74 new_file = copy_file(session = session,
75 directory = job.directory,
76 completion_directory_id = job.completion_directory_id,
77 file = file,
78 copy_instance_list = False)
79 else: # assume use existing
80 new_file = file
81 new_file.ann_is_complete = False
82 session.add(new_file)
83
84 new_file.job_id = job.id
85 # We assume this only works for the "root" file
86 # ie for video, for the video file itself
87 # We assign job id here in advance since functions like export depend on it
88
89 # TODO number of passes
90 # TODO advaned label options
91
92 # TODO this is confusing to call it "file_original_id" when it's a copy??
93
94 task = task_new(session = session,
95 job = job,
96 file_id = new_file.id,
97 file_original_id = file.id,
98 guide_id = guide_id,
99 label_dict = job.label_dict,
100 incoming_directory = job.directory)
101
102 task.is_root = True

Callers 1

provision_root_tasksFunction · 0.85

Calls 3

copy_fileFunction · 0.85
task_newFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected