|
3 | 3 | import json |
4 | 4 | import attr |
5 | 5 | from ..utils.messenger import send_message, make_message, gen_uuid, now, AuditFlag |
6 | | -from .helpers import ensure_list, gather_runtime_info, hash_file |
7 | | -from .specs import attr_fields, File, Directory |
| 6 | +from ..utils.hash import hash_function |
| 7 | +from .helpers import ensure_list, gather_runtime_info |
| 8 | +from .specs import attr_fields |
| 9 | +from fileformats.core import FileSet |
8 | 10 |
|
9 | 11 | try: |
10 | 12 | import importlib_resources |
@@ -181,10 +183,11 @@ def audit_task(self, task): |
181 | 183 | command = task.cmdline if hasattr(task.inputs, "executable") else None |
182 | 184 | attr_list = attr_fields(task.inputs) |
183 | 185 | for attrs in attr_list: |
184 | | - if attrs.type in [File, Directory]: |
185 | | - input_name = attrs.name |
186 | | - input_path = os.path.abspath(getattr(task.inputs, input_name)) |
187 | | - file_hash = hash_file(input_path) |
| 186 | + input_name = attrs.name |
| 187 | + value = getattr(task.inputs, input_name) |
| 188 | + if isinstance(value, FileSet): |
| 189 | + input_path = os.path.abspath(value) |
| 190 | + file_hash = hash_function(value) |
188 | 191 | entity_id = f"uid:{gen_uuid()}" |
189 | 192 | entity_message = { |
190 | 193 | "@id": entity_id, |
|
0 commit comments