From 1750ec07f11add39de5204bea7863876ec265238 Mon Sep 17 00:00:00 2001
From: George Ge <george.jiaqi.ge@gmail.com>
Date: Tue, 5 Nov 2024 07:08:01 +0000
Subject: [PATCH] remove cron requirement for Job

---
 sen2chain/jobs.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sen2chain/jobs.py b/sen2chain/jobs.py
index 277a53d..ee9f923 100644
--- a/sen2chain/jobs.py
+++ b/sen2chain/jobs.py
@@ -133,7 +133,7 @@ class Job:
     """
 
     # logger.propagate = False
-    def __init__(self, jid: str):
+    def __init__(self, jid: str, with_cron: bool = True):
         self.false_list = ["", "False", False, None, "None", [], [""], [None], ["None"], [False], ["False"]]
         self._config_path = Config()._JOBS_DIR / ("job_" + jid + ".cfg")
         self._python_script_path = Config()._JOBS_DIR / ("job_" + jid + ".py")
@@ -157,8 +157,8 @@ class Job:
         else:
             logger.info("Creating new job...")
             self.init()
-        self._cron = CronTab(user=True)
-        self.cron_status = self.get_cron_status()
+        self._cron = CronTab(user=True) if with_cron else None
+        self.cron_status = self.get_cron_status() if with_cron else None
 
         self._log_folder_path = Path(Config().get("log_path")) / ("job_" + jid)
         self.remove_used_l1c = False
-- 
GitLab