Skip to content

Commit

Permalink
usedmem bug
Browse files Browse the repository at this point in the history
wasn't setting it correctly
  • Loading branch information
ACEnglish committed Jun 3, 2024
1 parent b651fcc commit 8f63999
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tdb/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
S_COLUMNS = ["LocusID", "allele_number", "spanning_reads", "length_range_lower",
"length_range_upper", "average_methylation"]

AVAILMEM = sys.maxsize
# Give 25% overhead since our memory tracking probably underestimates
USEDMEM = int(AVAILMEM * 0.75)
AVAILMEM = 1e11 # 100GB default
# Give 20% overhead since our memory tracking probably underestimates
USEDMEM = int(AVAILMEM * 0.20)

def check_args(args):
"""
Expand Down Expand Up @@ -195,13 +195,14 @@ def write_tables(cur_tables, tables):
sample = pa.Table.from_pandas(sdf, schema=schema, preserve_index=False)
out_samp.write(sample)
# Reset memory
USEDMEM = int(AVAILMEM * 0.75)
USEDMEM = int(AVAILMEM * 0.20)

def create_main(args):
"""
Create a new tdb from multiple input calls
"""
global AVAILMEM
global USEDMEM
parser = argparse.ArgumentParser(prog="tdb create", description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("-o", "--output", metavar="OUT", required=True,
Expand All @@ -225,6 +226,7 @@ def create_main(args):
tdb.setup_logging()
if args.mem is not None:
AVAILMEM = args.mem * 1e9
USEDMEM = int(AVAILMEM * 0.20)

os.mkdir(args.output)

Expand Down

0 comments on commit 8f63999

Please sign in to comment.