ESGF/esgf-download

Untracking and then Tracking a Query removes the Query entirely

Closed this issue · 1 comments

A query which was previously tracked:

(esgdownload) ker:/net2/ker/UDA_downloads/esgf/db> esgpull show
<11586f>
└── distrib:       False                                                   
    latest:        True                                                    
    replica:       None                                                    
    retracted:     False                                                   
    experiment_id: historical                                              
    project:       CMIP6                                                   
    source_id:     GISS-E2-1-G                                             
    variable:      mmrbc, mmrdust, mmrnh4, mmrno3, mmroa, mmrso4, mmrss, o3
    files:         591.2 GiB / 601.1 GiB [822/833]

Afterwards, I decided to untrack it:

(esgdownload) ker:/net2/ker/UDA_downloads/esgf/log> esgpull untrack 11586f
👍 Query <11586f> is no longer tracked.
(esgdownload) ker:/net2/ker/UDA_downloads/esgf/log> esgpull show
<11586f> untracked
└── distrib:       False                                                   
    latest:        True                                                    
    replica:       None                                                    
    retracted:     False                                                   
    experiment_id: historical                                              
    project:       CMIP6                                                   
    source_id:     GISS-E2-1-G                                             
    variable:      mmrbc, mmrdust, mmrnh4, mmrno3, mmroa, mmrso4, mmrss, o3
    files:         591.2 GiB / 601.1 GiB [822/833]

I then tried to re-track it but got some sort of error, though the command seemed to still proceed:

(esgdownload) ker:/net2/ker/UDA_downloads/esgf/log> esgpull track 11586f
/net2/ker/anaconda3/envs/esgdownload/lib/python3.12/site-packages/esgpull/database.py:143: SAWarning: Object of type <Query> not in session, add operation along 'File.queries' won't proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
  result = self.session.merge(item)
👍 <11586f> is now tracked.
(esgdownload) ker:/net2/ker/UDA_downloads/esgf/log> esgpull show
(esgdownload) ker:/net2/ker/UDA_downloads/esgf/log>

As seen above, when running esgpull show a third time, the query has been inadvertently deleted. I'm presuming this is not intended behavior and the query should simply be put back into a "tracked" state.

Nice find, and sorry for the inconvenience, I've fixed that in main.