Skip to content

Conversation

@benjeffery
Copy link
Member

Fixes #2219

@benjeffery benjeffery force-pushed the renumber_no_metadata branch from 3d579e2 to a86532c Compare April 28, 2022 00:21
Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I think we probably need to think through the flags semantics for table collection init/table init a little more clearly, but this is a good step.

@benjeffery
Copy link
Member Author

Ha, I've actually created a collision here as all load flags are passed to init. I guess the only way to tidy this up nicely is to have a TSK_LOAD_INIT_* namespace, but it is a bit of a mouthful.

@benjeffery benjeffery force-pushed the renumber_no_metadata branch from a86532c to 496d6b7 Compare April 29, 2022 12:09
@benjeffery
Copy link
Member Author

@jeromekelleher After playing around I've added to the PR to try and sort out the load/init flags, giving them a shared name space. It actually revealed an error where the tests were only working due to a collision.

@codecov
Copy link

codecov bot commented Apr 29, 2022

Codecov Report

Merging #2224 (2ed6cd9) into main (2ed6cd9) will not change coverage.
The diff coverage is n/a.

❗ Current head 2ed6cd9 differs from pull request most recent head b1d3bfd. Consider uploading reports for the commit b1d3bfd to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2224   +/-   ##
=======================================
  Coverage   93.30%   93.30%           
=======================================
  Files          27       27           
  Lines       26003    26003           
  Branches     1165     1165           
=======================================
  Hits        24262    24262           
  Misses       1711     1711           
  Partials       30       30           
Flag Coverage Δ
c-tests 92.22% <0.00%> (ø)
lwt-tests 89.05% <0.00%> (ø)
python-c-tests 72.06% <0.00%> (ø)
python-tests 98.87% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ed6cd9...b1d3bfd. Read the comment docs.

@benjeffery benjeffery changed the title Move TSK_NO_EDGE_METADATA to avoid collision in future usage Rename int and load flags to common namespace Apr 29, 2022
Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this @benjeffery - what do you think of my suggestion of thinking of the flags to init/load as declaring properties of the thing (table,table collection) and namespace that way?

c/tskit/tables.h Outdated
#define TSK_LOAD_INIT_SKIP_TABLES (1 << 1)
#define TSK_LOAD_INIT_SKIP_REFERENCE_SEQUENCE (1 << 2)
#define TSK_LOAD_INIT_NO_EDGE_METADATA (1 << 3)
#define TSK_LOAD_INIT_BUILD_INDEXES (1 << 4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is different, in that it's only ever passed to tsk_treeseq_init(), right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could call TSK_TS_INIT_BUILD_INDEXES

c/tskit/tables.h Outdated
#define TSK_BUILD_INDEXES (1 << 0)
/* Flags for table collection load or init
* As flags are passed though from load to init they share a namespace */
#define TSK_LOAD_INIT_NO_METADATA (1 << 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOAD_INIT seems a bit weird. Aren't these properties of the table collection/tables, which we're specifying at init time? So we could say something like

// This table has no metadata
TSK_TABLE_NO_METADATA (1 << 0)

// This table collection will have no reference sequence/tables/edge metadata
TSK_TC_NO_REFERENCE_SEQUENCE(1 << 0)
TSK_TC_NO_TABLES(1 << 1)
TSK_TC_NO_EDGE_METADATA (1 << 2)

@benjeffery
Copy link
Member Author

I'm not sure this @benjeffery - what do you think of my suggestion of thinking of the flags to init/load as declaring properties of the thing (table,table collection) and namespace that way?

Yeah, will give that a try. Has to be better than this!

@benjeffery benjeffery force-pushed the renumber_no_metadata branch 2 times, most recently from 4c22aab to 26b9039 Compare May 3, 2022 11:21
@benjeffery
Copy link
Member Author

@jeromekelleher I think this makes more sense, have the shared namespace as a concept, but not all the same name.

c/tskit/tables.h Outdated
#define TSK_TABLE_NO_METADATA (1 << 1)
#define TSK_TC_SKIP_REFERENCE_SEQUENCE (1 << 2)
#define TSK_TC_NO_EDGE_METADATA (1 << 3)
#define TSK_TS_INIT_BUILD_INDEXES (1 << 4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't TSK_TS_INIT_BUILD_INDEXES belong in trees.h though, and live in a separate namespace? I don't think it interacts with the TableCollection of Table inits at all.

Ah, but SKIP_TABLES and SKIP_REFSEQ can also be passed to tsk_treeseq_load, right? So namespacing these as LOAD makes sense, maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the issue - all flags that get passed to tsk_treeseq_load get passed to tsk_table_collection_load and then all passed on again to tsk_table_collection_init or tsk_table_collection_loadf_inited. So they all need to be in this block.

You're right though TSK_TS_INIT_BUILD_INDEXES is unrelated - got confused with tsk_tc_init. Will move that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change the two "skips" to "loads" also as that makes more sense to me.

@benjeffery benjeffery force-pushed the renumber_no_metadata branch 2 times, most recently from af6ba3d to 1dd5bb7 Compare May 3, 2022 11:38
@benjeffery
Copy link
Member Author

I also need to add a detailed change log here.

@benjeffery benjeffery force-pushed the renumber_no_metadata branch 3 times, most recently from dadd44f to 3d75c86 Compare May 3, 2022 11:51
@jeromekelleher
Copy link
Member

OK great, so we have some flags that we specifiy for load, and additionaly flags that can get passed through to init. I think that's making sense now and we just have to be clear on the documentation for this.

@benjeffery benjeffery force-pushed the renumber_no_metadata branch from 3d75c86 to b1d3bfd Compare May 3, 2022 13:18
@mergify mergify bot merged commit 61a844a into tskit-dev:main May 3, 2022
@benjeffery benjeffery deleted the renumber_no_metadata branch May 3, 2022 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TSK_NO_METADATA and TSK_NO_EDGE_METADATA have the same value

2 participants