1 from pathlib
import Path
7 from coretex
import _task
11 if __name__ ==
"__main__":
12 taskRun, callback = _task.processRemote(sys.argv)
15 _task._prepareForExecution(taskRun)
16 _task.current_task_run.setCurrentTaskRun(taskRun)
20 logging.getLogger(
"coretexpylib").info(
">> [Coretex] TaskRun execution started")
21 logging.getLogger(
"coretexpylib").info(f
"\tPython: {sys.executable}")
23 entryPointDir = str(Path(taskRun.entryPoint).parent)
24 if entryPointDir
not in sys.path:
25 sys.path.append(entryPointDir)
27 _coretexPath = str(Path(__file__).resolve().parent)
28 if _coretexPath
in sys.path:
29 sys.path.remove(_coretexPath)
32 runpy.run_path(taskRun.entryPoint, {},
"__main__")
35 except RequestFailedError:
36 callback.onNetworkConnectionLost()
37 except KeyboardInterrupt:
38 callback.onKeyboardInterrupt()
39 except BaseException
as ex:
40 callback.onException(ex)