File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,18 @@ def parse_arguments():
22
22
args = parser .parse_args ()
23
23
return args
24
24
25
+
26
+ def check_dataset_lock (dataset_dbid ):
27
+ query_str = '/datasets/' + str (dataset_dbid ) + '/locks'
28
+ params = {}
29
+ resp = api .get_request (query_str , params = params , auth = True )
30
+ locks = resp .json ()['data' ]
31
+ if (locks ):
32
+ print ('Lock found for dataset id ' + str (dataset_dbid ) + '... sleeping...' )
33
+ time .sleep (2 )
34
+ check_dataset_lock (dataset_dbid )
35
+
36
+
25
37
if __name__ == '__main__' :
26
38
args = parse_arguments ()
27
39
dataverse_server = args .server .strip ("/" )
@@ -61,7 +73,8 @@ def parse_arguments():
61
73
})
62
74
resp = api .upload_datafile (
63
75
args .doi , join (root ,f ), df .json ())
64
- sleep (0.05 ) # give some time to upload
76
+ check_dataset_lock (
77
+ resp ['data' ]['files' ][0 ]['dataFile' ]['id' ])
65
78
66
79
# publish updated dataset
67
80
You can’t perform that action at this time.
0 commit comments