diff --git a/luigi/target.py b/luigi/target.py index 7ed094f094..86cac9dbad 100644 --- a/luigi/target.py +++ b/luigi/target.py @@ -284,7 +284,7 @@ def run(self): with self.output().temporary_path() as self.temp_output_path: run_some_external_command(output_path=self.temp_output_path) """ - num = random.randrange(0, 1e10) + num = random.randrange(0, 10000000000) slashless_path = self.path.rstrip('/').rstrip("\\") _temp_path = '{}-luigi-tmp-{:010}{}'.format( slashless_path, @@ -328,7 +328,7 @@ def close(self): self.move_to_final_destination() def generate_tmp_path(self, path): - return os.path.join(tempfile.gettempdir(), 'luigi-s3-tmp-%09d' % random.randrange(0, 1e10)) + return os.path.join(tempfile.gettempdir(), 'luigi-s3-tmp-%09d' % random.randrange(0, 10000000000)) def move_to_final_destination(self): raise NotImplementedError() diff --git a/luigi/worker.py b/luigi/worker.py index ba575b7fdf..84359e4740 100644 --- a/luigi/worker.py +++ b/luigi/worker.py @@ -158,7 +158,9 @@ def run(self): if self.use_multiprocessing: # Need to have different random seeds if running in separate processes - random.seed((os.getpid(), time.time())) + processID = os.getpid() + currentTime = time.time() + random.seed((processID, currentTime)) status = FAILED expl = ''