@@ -821,8 +821,8 @@ def result(self, state_index=None, return_inputs=False):
821
821
822
822
Returns
823
823
-------
824
- result :
825
-
824
+ result : Result
825
+ the result of the task
826
826
"""
827
827
# TODO: check if result is available in load_result and
828
828
# return a future if not
@@ -894,27 +894,33 @@ def _check_for_hash_changes(self):
894
894
details = ""
895
895
for changed in hash_changes :
896
896
field = getattr (attr .fields (type (self .inputs )), changed )
897
+ val = getattr (self .inputs , changed )
898
+ field_type = type (val )
897
899
if issubclass (field .type , FileSet ):
898
900
details += (
899
- f"- '{ changed } ' field is of file-type { field .type } . If it "
900
- "is intended to contain output data then the type of the field in "
901
- "the interface class should be changed to `pathlib.Path`. Otherwise, "
902
- "if the field is intended to be an input field but it gets altered by "
903
- "the task in some way, then the 'copyfile' flag should be set to "
904
- "'copy' in the field metadata of the task interface class so copies of "
905
- "the files/directories in it are passed to the task instead\n "
901
+ f"- { changed } : value passed to the { field .type } field is of type "
902
+ f"{ field_type } ('{ val } '). If it is intended to contain output data "
903
+ "then the type of the field in the interface class should be changed "
904
+ "to `pathlib.Path`. Otherwise, if the field is intended to be an "
905
+ "input field but it gets altered by the task in some way, then the "
906
+ "'copyfile' flag should be set to 'copy' in the field metadata of "
907
+ "the task interface class so copies of the files/directories in it "
908
+ "are passed to the task instead.\n "
906
909
)
907
910
else :
908
911
details += (
909
- f"- the { field .type } object passed to '{ changed } ' field appears to "
910
- f"have an unstable hash. The { field .type } .__bytes_repr__() method "
911
- "can be implemented to provide stable hashes for this type. "
912
- "See pydra/utils/hash.py for examples.\n "
912
+ f"- { changed } : the { field_type } object passed to the { field .type } "
913
+ f"field appears to have an unstable hash. This could be due to "
914
+ "a stochastic/non-thread-safe attribute(s) of the object\n \n "
915
+ f"The { field .type } .__bytes_repr__() method can be implemented to "
916
+ "bespoke hashing methods based only on the stable attributes for "
917
+ f"the `{ field_type .__module__ } .{ field_type .__name__ } ` type. "
918
+ f"See pydra/utils/hash.py for examples. Value: { val } \n "
913
919
)
914
920
if hash_changes :
915
921
raise RuntimeError (
916
922
f"Input field hashes have changed during the execution of the "
917
- f"'{ self .name } ' { type (self ).__name__ } .\n { details } "
923
+ f"'{ self .name } ' { type (self ).__name__ } .\n \n { details } "
918
924
)
919
925
logger .debug (
920
926
"Input values and hashes for '%s' %s node:\n %s\n %s" ,
0 commit comments