kblin: Hi there, thanks for the patch! I'll try to make some time to look at it this week.
diff --git a/ncbi_genome_download/core.py b/ncbi_genome_download/core.py
index 69efc2b..c99fd6b 100644
--- a/ncbi_genome_download/core.py
+++ b/ncbi_genome_download/core.py
@@ -192,15 +192,19 @@ def config_download(config):
 
         if config.parallel == 1:
             for entry, group in download_candidates:
-                download_jobs.extend(create_downloadjob(entry, group, config))
+                curr_jobs = create_downloadjob(entry, group, config)
+                fill_metadata(curr_jobs, entry)
+                download_jobs.extend(curr_jobs)
+
             for dl_job in download_jobs:
                 worker(dl_job)
         else:  # pragma: no cover
             # Testing multiprocessing code is annoying
             pool = Pool(processes=config.parallel)
 
-            for created_dl_job in pool.imap_unordered(downloadjob_creator_caller, [ (entry, group, config) for entry, group in download_candidates ]):
+            for index, created_dl_job in enumerate(pool.imap(downloadjob_creator_caller, [ (entry, group, config) for entry, group in download_candidates ])):
                 download_jobs.extend(created_dl_job)
+                fill_metadata(created_dl_job, download_candidates[index][0])#index is conserved from download_candidates with the use of imap
 
             jobs = pool.map_async(worker, download_jobs)
             try:
@@ -222,6 +226,11 @@ def config_download(config):
         return 75
     return 0
 
+def fill_metadata(jobs, entry):
+    for job in jobs:
+        if job.full_url is not None:#if it is None, it's a symlink making, so nothing to write
+            mtable = metadata.get()
+            mtable.add(entry, job.local_file)
 
 def select_candidates(config):
     """Select candidates to download.
@@ -534,10 +543,6 @@ def download_file_job(entry, directory, checksums, filetype='genbank', symlink_p
     if symlink_path is not None:
         full_symlink = os.path.join(symlink_path, filename)
 
-    # Keep metadata around
-    mtable = metadata.get()
-    mtable.add(entry, local_file)
-
     return DownloadJob(full_url, local_file, expected_checksum, full_symlink)
 # pylint: enable=too-many-arguments,too-many-locals
 

metadata option unworking
# version of ncbi-genome-download 
`0.2.11`

# command
```
python3 ncbi-genome-download/ncbi-genome-download-runner.py --verbose --genus "Kluyvera" --metadata
-table data.tsv --format fasta -p 10 --retries 1 bacteria
```

# result

All genomes are downloaded but the data.tsv file doesnt contains the metadata, only the header.


```
cat data.tsv 

assembly_accession	bioproject	biosample	wgs_master	excluded_from_refseq	refseq_category	relation_to_type_material	taxid	species_taxid	organism_name	infraspecific_name	isolate	version_status	assembly_level	release_type	genome_rep	seq_rel_date	asm_name	submitter	gbrs_paired_asm	paired_asm_comp	ftp_path	local_filename
```
diff --git a/tests/test_core.py b/tests/test_core.py
index dda0f74..4210c57 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4,12 +4,13 @@ from argparse import Namespace
 from collections import OrderedDict
 import os
 from os import path
+from multiprocessing import Pool
 
 import pytest
 import requests_mock
 from requests.exceptions import ConnectionError
 
-from ncbi_genome_download import core
+from ncbi_genome_download import core, metadata
 from ncbi_genome_download import NgdConfig, SUPPORTED_TAXONOMIC_GROUPS
 
 
@@ -132,6 +133,28 @@ def test_download_metadata(monkeypatch, mocker, req, tmpdir):
     assert core.create_downloadjob.call_count == 4
     assert metadata_file.check()
 
+def test_metadata_fill(req, tmpdir):
+    entry, config, _ = prepare_create_downloadjob(req, tmpdir)
+    metadata.clear()#clear it, otherwise operations realized in other tests might impact it
+    assert len(core.metadata.get().rows) == 0
+    jobs = core.create_downloadjob(entry, 'bacteria', config)
+    core.fill_metadata(jobs, entry)
+    assert len(core.metadata.get().rows) == 1
+
+def test_metadata_fill_multi(req, tmpdir):
+    entry, config, joblist = prepare_create_downloadjob(req, tmpdir)
+    metadata.clear()#clear it, otherwise operations realized in other tests might impact it
+    jobs = []
+    assert len(core.metadata.get().rows) == 0
+    download_candidates = [(entry, 'bacteria')]
+    p = Pool(processes=1)
+    for index, created_dl_job in enumerate(p.imap(core.downloadjob_creator_caller, [ (curr_entry, curr_group, config) for curr_entry, curr_group in download_candidates ])):
+        jobs.extend(created_dl_job)
+        assert download_candidates[index][0] == entry
+        core.fill_metadata(created_dl_job, download_candidates[index][0])
+    expected = [j for j in joblist if j.local_file.endswith('_genomic.gbff.gz')]
+    assert len(core.metadata.get().rows) == 1
+    assert jobs == expected
 
 def test_download_complete(monkeypatch, mocker, req):
     summary_contents = open(_get_file('assembly_status.txt'), 'r').read()

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest coverage pytest-cov requests-mock pytest-mock
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
appdirs==1.4.4
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
coverage==7.2.7
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
-e git+https://github.com/kblin/ncbi-genome-download.git@a46446733e70b7754b2bcb847cb6be3544ce73bc#egg=ncbi_genome_download
packaging==24.0
pluggy==1.2.0
pytest==7.4.4
pytest-cov==4.1.0
pytest-mock==3.11.1
requests==2.31.0
requests-mock==1.12.1
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: ncbi-genome-download
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - appdirs==1.4.4
      - charset-normalizer==3.4.1
      - coverage==7.2.7
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - packaging==24.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - pytest-cov==4.1.0
      - pytest-mock==3.11.1
      - requests==2.31.0
      - requests-mock==1.12.1
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/ncbi-genome-download

tests/test_core.py::test_metadata_fill tests/test_core.py::test_metadata_fill_multi
tests/test_core.py::test_download_defaults tests/test_core.py::test_args_download_defaults tests/test_core.py::test_download_defaults_nomatch tests/test_core.py::test_download_dry_run tests/test_core.py::test_download_one tests/test_core.py::test_download_connection_err tests/test_core.py::test_download tests/test_core.py::test_download_metadata tests/test_core.py::test_download_complete tests/test_core.py::test_download_chromosome tests/test_core.py::test_download_scaffold tests/test_core.py::test_download_contig tests/test_core.py::test_download_genus tests/test_core.py::test_download_genus_lowercase tests/test_core.py::test_download_genus_fuzzy tests/test_core.py::test_download_taxid tests/test_core.py::test_download_species_taxid tests/test_core.py::test_download_refseq_category tests/test_core.py::test_download_type_material tests/test_core.py::test_download_type_material_no_match tests/test_core.py::test_get_summary tests/test_core.py::test_get_summary_error_handling tests/test_core.py::test_parse_summary tests/test_core.py::test_filter_entries tests/test_core.py::test_create_downloadjob_genbank tests/test_core.py::test_create_downloadjob_all tests/test_core.py::test_create_downloadjob_missing tests/test_core.py::test_create_downloadjob_human_readable tests/test_core.py::test_create_downloadjob_symlink_only tests/test_core.py::test_create_dir tests/test_core.py::test_create_dir_exists tests/test_core.py::test_create_dir_isfile tests/test_core.py::test_create_dir_flat tests/test_core.py::test_create_readable_dir tests/test_core.py::test_create_readable_dir_exists tests/test_core.py::test_create_readable_dir_isfile tests/test_core.py::test_create_readable_dir_virus tests/test_core.py::test_grab_checksums_file tests/test_core.py::test_parse_checksums tests/test_core.py::test_has_file_changed_no_file tests/test_core.py::test_has_file_changed tests/test_core.py::test_has_file_changed_unchanged tests/test_core.py::test_need_to_create_symlink_no_symlink tests/test_core.py::test_need_to_create_symlink_correct_link tests/test_core.py::test_need_to_create_symlink tests/test_core.py::test_md5sum tests/test_core.py::test_download_file_genbank tests/test_core.py::test_download_file_genbank_mismatch tests/test_core.py::test_download_file_fasta tests/test_core.py::test_download_file_cds_fasta tests/test_core.py::test_download_file_rna_fasta tests/test_core.py::test_download_file_rna_fna tests/test_core.py::test_download_file_rm_out tests/test_core.py::test_download_file_symlink_path tests/test_core.py::test_create_symlink_job tests/test_core.py::test_create_symlink_job_remove_symlink tests/test_core.py::test_download_file_symlink_path_existed tests/test_core.py::test_get_genus_label tests/test_core.py::test_get_species_label tests/test_core.py::test_get_strain_label
ncbi_genome_download/core.py
ncbi_genome_download/core.py