@@ -128,11 +128,10 @@ def retry(job, force=False):
128128
129129 return new_id
130130
131-
132131 @staticmethod
133- def enqueue_job (job_map , origin , perm_check_uid = None ):
132+ def validate_job (job_map , origin , create_job = False , perm_check_uid = None ):
134133 """
135- Using a payload for a proposed job, creates and returns (but does not insert)
134+ Using a payload for a proposed job, creates and returns(if create_job is True) (but does not insert)
136135 a Job object. This preperation includes:
137136 - confirms gear exists
138137 - validates config against gear manifest
@@ -251,8 +250,17 @@ def enqueue_job(job_map, origin, perm_check_uid=None):
251250
252251 if gear_name not in tags :
253252 tags .append (gear_name )
253+ if create_job :
254+ job = Job (str (gear ['_id' ]), inputs , destination = destination , tags = tags , config_ = config_ , now = now_flag , attempt = attempt_n , previous_job_id = previous_job_id , origin = origin , batch = batch )
255+ return job
256+ return True
254257
255- job = Job (str (gear ['_id' ]), inputs , destination = destination , tags = tags , config_ = config_ , now = now_flag , attempt = attempt_n , previous_job_id = previous_job_id , origin = origin , batch = batch )
258+ @staticmethod
259+ def enqueue_job (job_map , origin , perm_check_uid = None ):
260+ """
261+ Validates, Creates, Inserts, and Returns job
262+ """
263+ job = Queue .validate_job (job_map , origin , create_job = True , perm_check_uid = perm_check_uid )
256264 job .insert ()
257265 return job
258266
0 commit comments