populate_all_common.py
log_insert_error(table, err, error_constants=None)
¶
Log a given error to the InsertError table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
str
|
The table name where the error occurred. |
required |
err
|
Exception
|
The exception that was raised. |
required |
error_constants
|
dict
|
Dictionary with keys for dj_user, connection_id, and nwb_file_name. Defaults to checking dj.conn and using "Unknown" for nwb_file_name. |
None
|
Source code in src/spyglass/common/populate_all_common.py
single_transaction_make(tables, nwb_file_name, raise_err=False, error_constants=None, config=None)
¶
Ingest each table from the NWB file, inside one transaction.
Every table here is a SpyglassIngestion table, so each parses the file
once via insert_from_nwbfile rather than running make per key_source
key. Failures are logged per table unless raise_err is set.
Source code in src/spyglass/common/populate_all_common.py
populate_all_common(nwb_file_name, rollback_on_fail=False, raise_err=False)
¶
Insert all common tables for a given NWB file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nwb_file_name
|
str
|
The name of the NWB file to populate. |
required |
rollback_on_fail
|
bool
|
If True, will delete the Session entry if any errors occur. Defaults to False. |
False
|
raise_err
|
bool
|
If True, will raise any errors that occur during population. Defaults to False. This will prevent any rollback from occurring. |
False
|
Returns:
| Type | Description |
|---|---|
List
|
A list of keys for InsertError entries if any errors occurred. |
Notes
InsertError rows logged by an earlier attempt at the same file, under the same user and connection, are cleared before population starts, so the returned list only ever describes the current attempt.
Source code in src/spyglass/common/populate_all_common.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |