-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes RUN_PY a part of linting and testing, as suggested by Sebastian Björkqvist
- Loading branch information
1 parent
3e5ee4e
commit 727e4cf
Showing
5 changed files
with
50 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" | ||
python file to run python tasks | ||
""" | ||
|
||
import json | ||
import pickle | ||
import argparse | ||
|
||
|
||
def main(): | ||
# parse args | ||
parser = argparse.ArgumentParser(description="Run function with params.") | ||
parser.add_argument("func", type=str) | ||
parser.add_argument("indx", type=int) | ||
args = parser.parse_args() | ||
|
||
# import module | ||
func = __import__(args.func) | ||
|
||
# open params and atoms | ||
with open(f"params{args.indx}.json") as fio: | ||
params = json.load(fio) | ||
with open("atoms.pkl", "rb") as fio: | ||
atoms = pickle.load(fio) | ||
|
||
# run func | ||
atoms = func.main(atoms, **params) | ||
|
||
# write atoms | ||
with open("atoms.pkl", "wb") as fio: | ||
pickle.dump(atoms, fio) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters