test_postgresql.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. import logging
  2. import pytest
  3. from flexmock import flexmock
  4. from borgmatic.hooks import postgresql as module
  5. def test_database_names_to_dump_passes_through_individual_database_name():
  6. database = {'name': 'foo'}
  7. assert module.database_names_to_dump(database, flexmock(), flexmock(), flexmock()) == ('foo',)
  8. def test_database_names_to_dump_passes_through_individual_database_name_with_format():
  9. database = {'name': 'foo', 'format': 'custom'}
  10. assert module.database_names_to_dump(database, flexmock(), flexmock(), flexmock()) == ('foo',)
  11. def test_database_names_to_dump_passes_through_all_without_format():
  12. database = {'name': 'all'}
  13. assert module.database_names_to_dump(database, flexmock(), flexmock(), flexmock()) == ('all',)
  14. def test_database_names_to_dump_with_all_and_format_lists_databases():
  15. database = {'name': 'all', 'format': 'custom'}
  16. flexmock(module).should_receive('execute_command_and_capture_output').and_return(
  17. 'foo,test,\nbar,test,"stuff and such"'
  18. )
  19. assert module.database_names_to_dump(database, flexmock(), flexmock(), flexmock()) == (
  20. 'foo',
  21. 'bar',
  22. )
  23. def test_database_names_to_dump_with_all_and_format_excludes_particular_databases():
  24. database = {'name': 'all', 'format': 'custom'}
  25. flexmock(module).should_receive('execute_command_and_capture_output').and_return(
  26. 'foo,test,\ntemplate0,test,blah'
  27. )
  28. assert module.database_names_to_dump(database, flexmock(), flexmock(), flexmock()) == ('foo',)
  29. def test_dump_databases_runs_pg_dump_for_each_database():
  30. databases = [{'name': 'foo'}, {'name': 'bar'}]
  31. processes = [flexmock(), flexmock()]
  32. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  33. flexmock(module).should_receive('make_dump_path').and_return('')
  34. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',)).and_return(
  35. ('bar',)
  36. )
  37. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  38. 'databases/localhost/foo'
  39. ).and_return('databases/localhost/bar')
  40. flexmock(module.os.path).should_receive('exists').and_return(False)
  41. flexmock(module.dump).should_receive('create_named_pipe_for_dump')
  42. for name, process in zip(('foo', 'bar'), processes):
  43. flexmock(module).should_receive('execute_command').with_args(
  44. (
  45. 'pg_dump',
  46. '--no-password',
  47. '--clean',
  48. '--if-exists',
  49. '--format',
  50. 'custom',
  51. name,
  52. '>',
  53. 'databases/localhost/{}'.format(name),
  54. ),
  55. shell=True,
  56. extra_environment={'PGSSLMODE': 'disable'},
  57. run_to_completion=False,
  58. ).and_return(process).once()
  59. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == processes
  60. def test_dump_databases_raises_when_no_database_names_to_dump():
  61. databases = [{'name': 'foo'}, {'name': 'bar'}]
  62. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  63. flexmock(module).should_receive('make_dump_path').and_return('')
  64. flexmock(module).should_receive('database_names_to_dump').and_return(())
  65. with pytest.raises(ValueError):
  66. module.dump_databases(databases, 'test.yaml', {}, dry_run=False)
  67. def test_dump_databases_with_dupliate_dump_skips_pg_dump():
  68. databases = [{'name': 'foo'}, {'name': 'bar'}]
  69. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  70. flexmock(module).should_receive('make_dump_path').and_return('')
  71. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',)).and_return(
  72. ('bar',)
  73. )
  74. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  75. 'databases/localhost/foo'
  76. ).and_return('databases/localhost/bar')
  77. flexmock(module.os.path).should_receive('exists').and_return(True)
  78. flexmock(module.dump).should_receive('create_named_pipe_for_dump').never()
  79. flexmock(module).should_receive('execute_command').never()
  80. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == []
  81. def test_dump_databases_with_dry_run_skips_pg_dump():
  82. databases = [{'name': 'foo'}, {'name': 'bar'}]
  83. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  84. flexmock(module).should_receive('make_dump_path').and_return('')
  85. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',)).and_return(
  86. ('bar',)
  87. )
  88. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  89. 'databases/localhost/foo'
  90. ).and_return('databases/localhost/bar')
  91. flexmock(module.os.path).should_receive('exists').and_return(False)
  92. flexmock(module.dump).should_receive('create_named_pipe_for_dump').never()
  93. flexmock(module).should_receive('execute_command').never()
  94. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=True) == []
  95. def test_dump_databases_runs_pg_dump_with_hostname_and_port():
  96. databases = [{'name': 'foo', 'hostname': 'database.example.org', 'port': 5433}]
  97. process = flexmock()
  98. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  99. flexmock(module).should_receive('make_dump_path').and_return('')
  100. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',))
  101. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  102. 'databases/database.example.org/foo'
  103. )
  104. flexmock(module.os.path).should_receive('exists').and_return(False)
  105. flexmock(module.dump).should_receive('create_named_pipe_for_dump')
  106. flexmock(module).should_receive('execute_command').with_args(
  107. (
  108. 'pg_dump',
  109. '--no-password',
  110. '--clean',
  111. '--if-exists',
  112. '--host',
  113. 'database.example.org',
  114. '--port',
  115. '5433',
  116. '--format',
  117. 'custom',
  118. 'foo',
  119. '>',
  120. 'databases/database.example.org/foo',
  121. ),
  122. shell=True,
  123. extra_environment={'PGSSLMODE': 'disable'},
  124. run_to_completion=False,
  125. ).and_return(process).once()
  126. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == [process]
  127. def test_dump_databases_runs_pg_dump_with_username_and_password():
  128. databases = [{'name': 'foo', 'username': 'postgres', 'password': 'trustsome1'}]
  129. process = flexmock()
  130. flexmock(module).should_receive('make_extra_environment').and_return(
  131. {'PGPASSWORD': 'trustsome1', 'PGSSLMODE': 'disable'}
  132. )
  133. flexmock(module).should_receive('make_dump_path').and_return('')
  134. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',))
  135. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  136. 'databases/localhost/foo'
  137. )
  138. flexmock(module.os.path).should_receive('exists').and_return(False)
  139. flexmock(module.dump).should_receive('create_named_pipe_for_dump')
  140. flexmock(module).should_receive('execute_command').with_args(
  141. (
  142. 'pg_dump',
  143. '--no-password',
  144. '--clean',
  145. '--if-exists',
  146. '--username',
  147. 'postgres',
  148. '--format',
  149. 'custom',
  150. 'foo',
  151. '>',
  152. 'databases/localhost/foo',
  153. ),
  154. shell=True,
  155. extra_environment={'PGPASSWORD': 'trustsome1', 'PGSSLMODE': 'disable'},
  156. run_to_completion=False,
  157. ).and_return(process).once()
  158. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == [process]
  159. def test_make_extra_environment_maps_options_to_environment():
  160. database = {
  161. 'name': 'foo',
  162. 'password': 'pass',
  163. 'ssl_mode': 'require',
  164. 'ssl_cert': 'cert.crt',
  165. 'ssl_key': 'key.key',
  166. 'ssl_root_cert': 'root.crt',
  167. 'ssl_crl': 'crl.crl',
  168. }
  169. expected = {
  170. 'PGPASSWORD': 'pass',
  171. 'PGSSLMODE': 'require',
  172. 'PGSSLCERT': 'cert.crt',
  173. 'PGSSLKEY': 'key.key',
  174. 'PGSSLROOTCERT': 'root.crt',
  175. 'PGSSLCRL': 'crl.crl',
  176. }
  177. extra_env = module.make_extra_environment(database)
  178. assert extra_env == expected
  179. def test_dump_databases_runs_pg_dump_with_directory_format():
  180. databases = [{'name': 'foo', 'format': 'directory'}]
  181. process = flexmock()
  182. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  183. flexmock(module).should_receive('make_dump_path').and_return('')
  184. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',))
  185. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  186. 'databases/localhost/foo'
  187. )
  188. flexmock(module.os.path).should_receive('exists').and_return(False)
  189. flexmock(module.dump).should_receive('create_parent_directory_for_dump')
  190. flexmock(module.dump).should_receive('create_named_pipe_for_dump').never()
  191. flexmock(module).should_receive('execute_command').with_args(
  192. (
  193. 'pg_dump',
  194. '--no-password',
  195. '--clean',
  196. '--if-exists',
  197. '--format',
  198. 'directory',
  199. '--file',
  200. 'databases/localhost/foo',
  201. 'foo',
  202. ),
  203. shell=True,
  204. extra_environment={'PGSSLMODE': 'disable'},
  205. run_to_completion=False,
  206. ).and_return(process).once()
  207. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == [process]
  208. def test_dump_databases_runs_pg_dump_with_options():
  209. databases = [{'name': 'foo', 'options': '--stuff=such'}]
  210. process = flexmock()
  211. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  212. flexmock(module).should_receive('make_dump_path').and_return('')
  213. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',))
  214. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  215. 'databases/localhost/foo'
  216. )
  217. flexmock(module.os.path).should_receive('exists').and_return(False)
  218. flexmock(module.dump).should_receive('create_named_pipe_for_dump')
  219. flexmock(module).should_receive('execute_command').with_args(
  220. (
  221. 'pg_dump',
  222. '--no-password',
  223. '--clean',
  224. '--if-exists',
  225. '--format',
  226. 'custom',
  227. '--stuff=such',
  228. 'foo',
  229. '>',
  230. 'databases/localhost/foo',
  231. ),
  232. shell=True,
  233. extra_environment={'PGSSLMODE': 'disable'},
  234. run_to_completion=False,
  235. ).and_return(process).once()
  236. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == [process]
  237. def test_dump_databases_runs_pg_dumpall_for_all_databases():
  238. databases = [{'name': 'all'}]
  239. process = flexmock()
  240. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  241. flexmock(module).should_receive('make_dump_path').and_return('')
  242. flexmock(module).should_receive('database_names_to_dump').and_return(('all',))
  243. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  244. 'databases/localhost/all'
  245. )
  246. flexmock(module.os.path).should_receive('exists').and_return(False)
  247. flexmock(module.dump).should_receive('create_named_pipe_for_dump')
  248. flexmock(module).should_receive('execute_command').with_args(
  249. ('pg_dumpall', '--no-password', '--clean', '--if-exists', '>', 'databases/localhost/all'),
  250. shell=True,
  251. extra_environment={'PGSSLMODE': 'disable'},
  252. run_to_completion=False,
  253. ).and_return(process).once()
  254. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == [process]
  255. def test_dump_databases_runs_non_default_pg_dump():
  256. databases = [{'name': 'foo', 'pg_dump_command': 'special_pg_dump'}]
  257. process = flexmock()
  258. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  259. flexmock(module).should_receive('make_dump_path').and_return('')
  260. flexmock(module).should_receive('database_names_to_dump').and_return(('foo',))
  261. flexmock(module.dump).should_receive('make_database_dump_filename').and_return(
  262. 'databases/localhost/foo'
  263. )
  264. flexmock(module.os.path).should_receive('exists').and_return(False)
  265. flexmock(module.dump).should_receive('create_named_pipe_for_dump')
  266. flexmock(module).should_receive('execute_command').with_args(
  267. (
  268. 'special_pg_dump',
  269. '--no-password',
  270. '--clean',
  271. '--if-exists',
  272. '--format',
  273. 'custom',
  274. 'foo',
  275. '>',
  276. 'databases/localhost/foo',
  277. ),
  278. shell=True,
  279. extra_environment={'PGSSLMODE': 'disable'},
  280. run_to_completion=False,
  281. ).and_return(process).once()
  282. assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == [process]
  283. def test_restore_database_dump_runs_pg_restore():
  284. database_config = [{'name': 'foo'}]
  285. extract_process = flexmock(stdout=flexmock())
  286. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  287. flexmock(module).should_receive('make_dump_path')
  288. flexmock(module.dump).should_receive('make_database_dump_filename')
  289. flexmock(module).should_receive('execute_command_with_processes').with_args(
  290. (
  291. 'pg_restore',
  292. '--no-password',
  293. '--if-exists',
  294. '--exit-on-error',
  295. '--clean',
  296. '--dbname',
  297. 'foo',
  298. ),
  299. processes=[extract_process],
  300. output_log_level=logging.DEBUG,
  301. input_file=extract_process.stdout,
  302. extra_environment={'PGSSLMODE': 'disable'},
  303. ).once()
  304. flexmock(module).should_receive('execute_command').with_args(
  305. ('psql', '--no-password', '--quiet', '--dbname', 'foo', '--command', 'ANALYZE'),
  306. extra_environment={'PGSSLMODE': 'disable'},
  307. ).once()
  308. module.restore_database_dump(
  309. database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process
  310. )
  311. def test_restore_database_dump_errors_on_multiple_database_config():
  312. database_config = [{'name': 'foo'}, {'name': 'bar'}]
  313. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  314. flexmock(module).should_receive('make_dump_path')
  315. flexmock(module.dump).should_receive('make_database_dump_filename')
  316. flexmock(module).should_receive('execute_command_with_processes').never()
  317. flexmock(module).should_receive('execute_command').never()
  318. with pytest.raises(ValueError):
  319. module.restore_database_dump(
  320. database_config, 'test.yaml', {}, dry_run=False, extract_process=flexmock()
  321. )
  322. def test_restore_database_dump_runs_pg_restore_with_hostname_and_port():
  323. database_config = [{'name': 'foo', 'hostname': 'database.example.org', 'port': 5433}]
  324. extract_process = flexmock(stdout=flexmock())
  325. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  326. flexmock(module).should_receive('make_dump_path')
  327. flexmock(module.dump).should_receive('make_database_dump_filename')
  328. flexmock(module).should_receive('execute_command_with_processes').with_args(
  329. (
  330. 'pg_restore',
  331. '--no-password',
  332. '--if-exists',
  333. '--exit-on-error',
  334. '--clean',
  335. '--dbname',
  336. 'foo',
  337. '--host',
  338. 'database.example.org',
  339. '--port',
  340. '5433',
  341. ),
  342. processes=[extract_process],
  343. output_log_level=logging.DEBUG,
  344. input_file=extract_process.stdout,
  345. extra_environment={'PGSSLMODE': 'disable'},
  346. ).once()
  347. flexmock(module).should_receive('execute_command').with_args(
  348. (
  349. 'psql',
  350. '--no-password',
  351. '--quiet',
  352. '--host',
  353. 'database.example.org',
  354. '--port',
  355. '5433',
  356. '--dbname',
  357. 'foo',
  358. '--command',
  359. 'ANALYZE',
  360. ),
  361. extra_environment={'PGSSLMODE': 'disable'},
  362. ).once()
  363. module.restore_database_dump(
  364. database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process
  365. )
  366. def test_restore_database_dump_runs_pg_restore_with_username_and_password():
  367. database_config = [{'name': 'foo', 'username': 'postgres', 'password': 'trustsome1'}]
  368. extract_process = flexmock(stdout=flexmock())
  369. flexmock(module).should_receive('make_extra_environment').and_return(
  370. {'PGPASSWORD': 'trustsome1', 'PGSSLMODE': 'disable'}
  371. )
  372. flexmock(module).should_receive('make_dump_path')
  373. flexmock(module.dump).should_receive('make_database_dump_filename')
  374. flexmock(module).should_receive('execute_command_with_processes').with_args(
  375. (
  376. 'pg_restore',
  377. '--no-password',
  378. '--if-exists',
  379. '--exit-on-error',
  380. '--clean',
  381. '--dbname',
  382. 'foo',
  383. '--username',
  384. 'postgres',
  385. ),
  386. processes=[extract_process],
  387. output_log_level=logging.DEBUG,
  388. input_file=extract_process.stdout,
  389. extra_environment={'PGPASSWORD': 'trustsome1', 'PGSSLMODE': 'disable'},
  390. ).once()
  391. flexmock(module).should_receive('execute_command').with_args(
  392. (
  393. 'psql',
  394. '--no-password',
  395. '--quiet',
  396. '--username',
  397. 'postgres',
  398. '--dbname',
  399. 'foo',
  400. '--command',
  401. 'ANALYZE',
  402. ),
  403. extra_environment={'PGPASSWORD': 'trustsome1', 'PGSSLMODE': 'disable'},
  404. ).once()
  405. module.restore_database_dump(
  406. database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process
  407. )
  408. def test_restore_database_dump_runs_psql_for_all_database_dump():
  409. database_config = [{'name': 'all'}]
  410. extract_process = flexmock(stdout=flexmock())
  411. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  412. flexmock(module).should_receive('make_dump_path')
  413. flexmock(module.dump).should_receive('make_database_dump_filename')
  414. flexmock(module).should_receive('execute_command_with_processes').with_args(
  415. ('psql', '--no-password'),
  416. processes=[extract_process],
  417. output_log_level=logging.DEBUG,
  418. input_file=extract_process.stdout,
  419. extra_environment={'PGSSLMODE': 'disable'},
  420. ).once()
  421. flexmock(module).should_receive('execute_command').with_args(
  422. ('psql', '--no-password', '--quiet', '--command', 'ANALYZE'),
  423. extra_environment={'PGSSLMODE': 'disable'},
  424. ).once()
  425. module.restore_database_dump(
  426. database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process
  427. )
  428. def test_restore_database_dump_runs_non_default_pg_restore_and_psql():
  429. database_config = [
  430. {'name': 'foo', 'pg_restore_command': 'special_pg_restore', 'psql_command': 'special_psql'}
  431. ]
  432. extract_process = flexmock(stdout=flexmock())
  433. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  434. flexmock(module).should_receive('make_dump_path')
  435. flexmock(module.dump).should_receive('make_database_dump_filename')
  436. flexmock(module).should_receive('execute_command_with_processes').with_args(
  437. (
  438. 'special_pg_restore',
  439. '--no-password',
  440. '--if-exists',
  441. '--exit-on-error',
  442. '--clean',
  443. '--dbname',
  444. 'foo',
  445. ),
  446. processes=[extract_process],
  447. output_log_level=logging.DEBUG,
  448. input_file=extract_process.stdout,
  449. extra_environment={'PGSSLMODE': 'disable'},
  450. ).once()
  451. flexmock(module).should_receive('execute_command').with_args(
  452. ('special_psql', '--no-password', '--quiet', '--dbname', 'foo', '--command', 'ANALYZE'),
  453. extra_environment={'PGSSLMODE': 'disable'},
  454. ).once()
  455. module.restore_database_dump(
  456. database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process
  457. )
  458. def test_restore_database_dump_with_dry_run_skips_restore():
  459. database_config = [{'name': 'foo'}]
  460. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  461. flexmock(module).should_receive('make_dump_path')
  462. flexmock(module.dump).should_receive('make_database_dump_filename')
  463. flexmock(module).should_receive('execute_command_with_processes').never()
  464. module.restore_database_dump(
  465. database_config, 'test.yaml', {}, dry_run=True, extract_process=flexmock()
  466. )
  467. def test_restore_database_dump_without_extract_process_restores_from_disk():
  468. database_config = [{'name': 'foo'}]
  469. flexmock(module).should_receive('make_extra_environment').and_return({'PGSSLMODE': 'disable'})
  470. flexmock(module).should_receive('make_dump_path')
  471. flexmock(module.dump).should_receive('make_database_dump_filename').and_return('/dump/path')
  472. flexmock(module).should_receive('execute_command_with_processes').with_args(
  473. (
  474. 'pg_restore',
  475. '--no-password',
  476. '--if-exists',
  477. '--exit-on-error',
  478. '--clean',
  479. '--dbname',
  480. 'foo',
  481. '/dump/path',
  482. ),
  483. processes=[],
  484. output_log_level=logging.DEBUG,
  485. input_file=None,
  486. extra_environment={'PGSSLMODE': 'disable'},
  487. ).once()
  488. flexmock(module).should_receive('execute_command').with_args(
  489. ('psql', '--no-password', '--quiet', '--dbname', 'foo', '--command', 'ANALYZE'),
  490. extra_environment={'PGSSLMODE': 'disable'},
  491. ).once()
  492. module.restore_database_dump(
  493. database_config, 'test.yaml', {}, dry_run=False, extract_process=None
  494. )