You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56Lines changed: 56 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,7 @@ Alternatively, you can also supply a `config` file that contains all necessary i
93
93
*`mimetype`: Mimetype of the file.
94
94
*`categories`: Optional list of categories to assign to the file.
95
95
*`restrict`: Boolean to indicate that this is a restricted file. Defaults to False.
96
+
*`tabIngest`: Boolean to indicate that the file should be ingested as a tab-separated file. Defaults to True.
96
97
97
98
In the following example, we upload three files to a Dataverse instance. The first file is uploaded to the root directory of the dataset, while the other two files are uploaded to the directory `some/dir`.
98
99
@@ -115,6 +116,61 @@ The `config` file can then be used as follows:
115
116
dvuploader --config-path config.yml
116
117
```
117
118
119
+
### Environment variables
120
+
121
+
DVUploader provides several environment variables that allow you to control retry logic and upload size limits. These can be set either through environment variables directly or programmatically using the `config` function.
122
+
123
+
**Available Environment Variables:**
124
+
- `DVUPLOADER_MAX_RETRIES`: Maximum number of retry attempts (default: 15)
125
+
- `DVUPLOADER_MAX_RETRY_TIME`: Maximum wait time between retries in seconds (default: 240)
126
+
- `DVUPLOADER_MIN_RETRY_TIME`: Minimum wait time between retries in seconds (default: 1)
127
+
- `DVUPLOADER_RETRY_MULTIPLIER`: Multiplier for exponential backoff (default: 0.1)
128
+
- `DVUPLOADER_MAX_PKG_SIZE`: Maximum package size in bytes (default: 2GB)
129
+
130
+
**Setting via environment:**
131
+
```bash
132
+
export DVUPLOADER_MAX_RETRIES=20
133
+
export DVUPLOADER_MAX_RETRY_TIME=300
134
+
export DVUPLOADER_MIN_RETRY_TIME=2
135
+
export DVUPLOADER_RETRY_MULTIPLIER=0.2
136
+
export DVUPLOADER_MAX_PKG_SIZE=3221225472 # 3GB
137
+
```
138
+
139
+
**Setting programmatically:**
140
+
```python
141
+
import dvuploader as dv
142
+
143
+
# Configure the uploader settings
144
+
dv.config(
145
+
max_retries=20,
146
+
max_retry_time=300,
147
+
min_retry_time=2,
148
+
retry_multiplier=0.2,
149
+
max_package_size=3 * 1024**3 # 3GB
150
+
)
151
+
152
+
# Continue with your upload as normal
153
+
files = [dv.File(filepath="./data.csv")]
154
+
dvuploader = dv.DVUploader(files=files)
155
+
# ... rest of your upload code
156
+
```
157
+
158
+
The retry logic uses exponential backoff which ensures that subsequent retries will be longer, but won't exceed exceed `max_retry_time`. This is particularly useful when dealing with native uploads that may be subject to intermediate locks on the Dataverse side.
159
+
160
+
## Troubleshooting
161
+
162
+
#### `500` error and `OptimisticLockException`
163
+
164
+
When uploading multiple tabular files, you might encounter a `500` error and a `OptimisticLockException` upon the file registration step. This has been discussed in https://github.com/IQSS/dataverse/issues/11265 and is due to the fact that intermediate locks prevent the file registration step from completing.
165
+
166
+
A workaround is to set the `tabIngest` flag to `False` for all files that are to be uploaded. This will cause the files not be ingested but will avoid the intermediate locks.
Please be aware that your tabular files will not be ingested as such but will be uploaded in their native format. You can utilize [pyDataverse](https://github.com/gdcc/pyDataverse/blob/693d0ff8d2849eccc32f9e66228ee8976109881a/pyDataverse/api.py#L2475) to ingest the files after they have been uploaded.
173
+
118
174
## Development
119
175
120
176
To install the development dependencies, run the following command:
0 commit comments