Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
OpenFold
Commits
e6780504
Commit
e6780504
authored
Mar 19, 2024
by
Lukas Jarosch
Browse files
Add default shard number
parent
77860bb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
scripts/alignment_db_scripts/create_alignment_db_sharded.py
scripts/alignment_db_scripts/create_alignment_db_sharded.py
+12
-1
No files found.
scripts/alignment_db_scripts/create_alignment_db_sharded.py
View file @
e6780504
...
@@ -11,6 +11,7 @@ import json
...
@@ -11,6 +11,7 @@ import json
from
collections
import
defaultdict
from
collections
import
defaultdict
from
concurrent.futures
import
ProcessPoolExecutor
,
ThreadPoolExecutor
,
as_completed
from
concurrent.futures
import
ProcessPoolExecutor
,
ThreadPoolExecutor
,
as_completed
from
math
import
ceil
from
math
import
ceil
from
multiprocessing
import
cpu_count
from
pathlib
import
Path
from
pathlib
import
Path
from
tqdm
import
tqdm
from
tqdm
import
tqdm
...
@@ -132,6 +133,13 @@ def main(args):
...
@@ -132,6 +133,13 @@ def main(args):
output_db_name
=
args
.
output_db_name
output_db_name
=
args
.
output_db_name
n_shards
=
args
.
n_shards
n_shards
=
args
.
n_shards
n_cpus
=
cpu_count
()
if
n_shards
>
n_cpus
:
print
(
f
"Warning: Your number of shards (
{
n_shards
}
) is greater than the number of cores on your machine (
{
n_cpus
}
). "
"This may result in slower performance. Consider using a smaller number of shards."
)
# get all chain dirs in alignment_dir
# get all chain dirs in alignment_dir
print
(
"Getting chain directories..."
)
print
(
"Getting chain directories..."
)
all_chain_dirs
=
sorted
([
f
for
f
in
tqdm
(
alignment_dir
.
iterdir
())])
all_chain_dirs
=
sorted
([
f
for
f
in
tqdm
(
alignment_dir
.
iterdir
())])
...
@@ -189,7 +197,10 @@ if __name__ == "__main__":
...
@@ -189,7 +197,10 @@ if __name__ == "__main__":
parser
.
add_argument
(
"output_db_path"
,
type
=
Path
)
parser
.
add_argument
(
"output_db_path"
,
type
=
Path
)
parser
.
add_argument
(
"output_db_name"
,
type
=
str
)
parser
.
add_argument
(
"output_db_name"
,
type
=
str
)
parser
.
add_argument
(
parser
.
add_argument
(
"n_shards"
,
type
=
int
,
help
=
"Number of shards to split the database into"
"--n_shards"
,
type
=
int
,
help
=
"Number of shards to split the database into"
,
default
=
10
,
)
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment