Hi everyone,
I am encountering a ‘Bad request‘ error with status code 400 when trying to upload multiple files to CE (see attached code). Uploading a single file works without any issues, and the error only occurs when I attempt batch uploads.
Has anyone run into this before, or knows what might be causing it? Any pointers would be appreciated.
debug = True
models = ['crust_dft', 'cmf', 'ceft']
# container to store the uploaded file names and uuids
upload_synthesis_with_hyperons = {}
# loop over the files to be uploaded
for key, uuid in filenames.items():
print('Result:', key)
value = 0
upload_synthesis_with_hyperons[key] = {}
for model in models:
file_path= (f'/home/ania/projects/muses/explore_parameter_space/output_tests/cmf_crust_outdir/v3/{key}/{uuid}/lepton-{model}/opt/output/beta_equilibrium_eos.csv')
print('Check if file exists:', os.path.exists(file_path))
upload_path = f'synthesis_hyperons_test/{key}/{model}/eos.csv'
print('Upload path:', upload_path)
if debug:
print(f"Uploading {file_path} → {upload_path}")
upload = api.upload_file(
file_path=file_path,
upload_path=upload_path,
public=False
)
if upload:
print(f"Uploaded EoS file with UUID: {upload['uuid']} and checksum: {upload['checksum']}")
else:
print(f"Failed to upload EoS file reason: {upload.reason}, status code: {upload.status_code}")
# extract metadata
print(upload)
upload_uuid = upload.get('uuid')
checksum = upload.get('checksum')
# # store in structured form
upload_synthesis_with_hyperons[key][model] = {
'upload_path': upload_path,
'uuid': upload_uuid,
'checksum': checksum
}
# print(json.dumps(results, indent=2))
Output with the error message at the end:
Result: cmf_crust_with_hyperons_cmf_00060
Check if file exists: True
Upload path: synthesis_hyperons_test/cmf_crust_with_hyperons_cmf_00060/crust_dft/eos.csv
Uploading /home/ania/projects/muses/explore_parameter_space/output_tests/cmf_crust_outdir/v3/cmf_crust_with_hyperons_cmf_00060/7ab6b749-1c1b-4189-a042-0370b0c6d54a/lepton-crust_dft/opt/output/beta_equilibrium_eos.csv → synthesis_hyperons_test/cmf_crust_with_hyperons_cmf_00060/crust_dft/eos.csv
Failed to upload EoS file reason: Bad Request, status code: 400
<Response [400]>