Skip to content

Commit 356e3a4

Browse files
committed
Sort inputs of jobs for static identifier
1 parent 3233cd2 commit 356e3a4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

iptk/utils/job.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def add_input_dataset(self, dataset_id, path="/input"):
3636
"path": path
3737
}
3838
self.inputs.append(input)
39-
39+
self.sort_inputs()
40+
4041
def to_json(self):
4142
return json_pretty(self.spec)
4243

@@ -52,6 +53,9 @@ def request_resource(self, resource_type, quantity):
5253
self.resource_requests[resource_type] = quantity
5354
return self.resource_requests
5455

56+
def sort_inputs(self):
57+
self.inputs = sorted(self.inputs, key=lambda x: x.get("path", ""))
58+
5559
def enqueue(self, dataset_store):
5660
"""
5761
Enqueues this job by saving it into the given DatasetStore.
@@ -82,6 +86,7 @@ def minimal_spec(self):
8286
not include optional fields that are only relevant to the job scheduler
8387
(e.g. resource requests)
8488
"""
89+
self.sort_inputs()
8590
keys = ["version", "image", "command", "inputs"]
8691
spec = {x: self.spec[x] for x in keys}
8792
return spec

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
setup(
33
name = 'iptk',
44
packages = ['iptk', 'iptk.metadata', 'iptk.utils'],
5-
version = '0.5.1',
5+
version = '0.6',
66
description = 'Python interface to the Imaging Pipeline Toolkit',
77
author = 'Jan-Gerd Tenberge',
88
author_email = 'jan-gerd.tenberge@uni-muenster.de',

0 commit comments

Comments
 (0)