55import inspect
66import logging
77import multiprocessing as mp
8- import random
98import signal
109import traceback
1110
@@ -174,13 +173,10 @@ def populate(
174173 suppress_errors = False ,
175174 return_exception_objects = False ,
176175 reserve_jobs = False ,
177- order = "original" ,
178- limit = None ,
179176 max_calls = None ,
180177 display_progress = False ,
181178 processes = 1 ,
182179 make_kwargs = None ,
183- # New parameters for Autopopulate 2.0
184180 priority = None ,
185181 refresh = True ,
186182 ):
@@ -195,8 +191,6 @@ def populate(
195191 :param suppress_errors: if True, do not terminate execution.
196192 :param return_exception_objects: return error objects instead of just error messages
197193 :param reserve_jobs: if True, reserve jobs to populate in asynchronous fashion
198- :param order: "original"|"reverse"|"random" - the order of execution
199- :param limit: if not None, check at most this many keys
200194 :param max_calls: if not None, populate at most this many keys
201195 :param display_progress: if True, report progress_bar
202196 :param processes: number of processes to use. Set to None to use all cores
@@ -220,10 +214,6 @@ def populate(
220214 "Cannot call populate on a restricted table. " "Instead, pass conditions to populate() as arguments."
221215 )
222216
223- valid_order = ["original" , "reverse" , "random" ]
224- if order not in valid_order :
225- raise DataJointError ("The order argument must be one of %s" % str (valid_order ))
226-
227217 if reserve_jobs :
228218 # Define a signal handler for SIGTERM
229219 def handler (signum , frame ):
@@ -237,25 +227,18 @@ def handler(signum, frame):
237227
238228 if reserve_jobs :
239229 # Use jobs table for coordinated processing
240- keys = self .jobs .fetch_pending (limit = limit , priority = priority )
230+ keys = self .jobs .fetch_pending (limit = max_calls , priority = priority )
241231 if not keys and refresh :
242232 logger .debug ("No pending jobs found, refreshing jobs queue" )
243233 self .jobs .refresh (* restrictions )
244- keys = self .jobs .fetch_pending (limit = limit , priority = priority )
234+ keys = self .jobs .fetch_pending (limit = max_calls , priority = priority )
245235 else :
246236 # Without job reservations: compute keys directly from key_source
247237 if keys is None :
248238 todo = (self .key_source & AndList (restrictions )).proj ()
249- keys = (todo - self ).fetch ("KEY" , limit = limit )
250-
251- if order == "reverse" :
252- keys .reverse ()
253- elif order == "random" :
254- random .shuffle (keys )
239+ keys = (todo - self ).fetch ("KEY" , limit = max_calls )
255240
256241 logger .debug ("Found %d keys to populate" % len (keys ))
257-
258- keys = keys [:max_calls ]
259242 nkeys = len (keys )
260243
261244 if nkeys :
0 commit comments