Skip to content

Commit

Permalink
add check_dataset_lock
Browse files Browse the repository at this point in the history
Co-authored-by: Philip Durbin <philipdurbin@gmail.com>
  • Loading branch information
atrisovic and pdurbin committed Nov 15, 2021
1 parent a93f9d5 commit d92492f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dataverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ def parse_arguments():
args = parser.parse_args()
return args


def check_dataset_lock(dataset_dbid):
query_str = '/datasets/' + str(dataset_dbid) + '/locks'
params = {}
resp = api.get_request(query_str, params=params, auth=True)
locks = resp.json()['data']
if (locks):
print('Lock found for dataset id ' + str(dataset_dbid) + '... sleeping...')
time.sleep(2)
check_dataset_lock(dataset_dbid)


if __name__ == '__main__':
args = parse_arguments()
dataverse_server = args.server.strip("/")
Expand Down Expand Up @@ -61,7 +73,8 @@ def parse_arguments():
})
resp = api.upload_datafile(
args.doi, join(root,f), df.json())
sleep(0.05) # give some time to upload
check_dataset_lock(
resp['data']['files'][0]['dataFile']['id'])

# publish updated dataset

Expand Down

0 comments on commit d92492f

Please sign in to comment.