input.status_text has error message if applicable
(self)
| 247 | |
| 248 | |
| 249 | def main_entry(self): |
| 250 | """ |
| 251 | |
| 252 | input.status_text has error message if applicable |
| 253 | """ |
| 254 | |
| 255 | start_time = time.time() |
| 256 | |
| 257 | check_and_wait_for_memory(memory_limit_float = 85.0) |
| 258 | |
| 259 | self.get_input_with_retry() |
| 260 | |
| 261 | if self.input is None: |
| 262 | logger.error("input is None") |
| 263 | return |
| 264 | |
| 265 | self.input.time_last_attempted = start_time |
| 266 | |
| 267 | if not self.input.update_log: |
| 268 | self.input.update_log = regular_log.default() |
| 269 | |
| 270 | self.project = self.input.project |
| 271 | |
| 272 | """ |
| 273 | Context that for detached from session processing |
| 274 | (ie media_type == 'frame'), if we try to access input.project.id |
| 275 | that will do a refresh from the session which will fail |
| 276 | because we are purposely not attaching input |
| 277 | |
| 278 | """ |
| 279 | self.project_id = self.input.project_id |
| 280 | if self.project is None: |
| 281 | self.project = Project.get_by_id( |
| 282 | session = self.session, |
| 283 | id = self.project_id) |
| 284 | |
| 285 | if self.input.allow_csv: |
| 286 | self.allow_csv = self.input.allow_csv |
| 287 | |
| 288 | self.input.status = "processing" |
| 289 | |
| 290 | if self.input.mode == "flow": |
| 291 | # Get directory from flow |
| 292 | self.input.directory = self.input.action_flow.directory |
| 293 | |
| 294 | self.try_to_commit() |
| 295 | |
| 296 | if self.input.mode == "copy_file": |
| 297 | self.__start_copy_file() |
| 298 | # Important! |
| 299 | # We are exiting main loop here |
| 300 | return |
| 301 | if self.input.mode == "update": |
| 302 | self.__update_existing_file(file = self.input.file) |
| 303 | # Important! |
| 304 | |
| 305 | # We are exiting main loop here |
| 306 | if len(self.log["error"].keys()) >= 1: |
no test coverage detected