Skip to content

Commit

Permalink
Remote workers for socket channel (#944)
Browse files Browse the repository at this point in the history
* allow socket channel workers on other machines, minor improvements for local
running

tbd: dynamic python worker codes, debug support

* fixes

* remote mkdir for sockets channel, add some warnings

* remove debug

* prefer f-strings for readability

* style updates

* get_amuse_root_directory to get_amuse_package_dir

* fix print

---------

Co-authored-by: Steven Rieder <steven+github@rieder.nl>
  • Loading branch information
ipelupessy and rieder committed Aug 30, 2023
1 parent 956155c commit b57c1e2
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 87 deletions.
17 changes: 9 additions & 8 deletions src/amuse/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@
import os
import warnings


def parse_configmk(filename):
configfile = open(filename, "r")
lines = configfile.readlines()
configfile.close()
def parse_configmk_lines(lines,label):
cfgvars = dict()
if "amuse configuration" not in lines[0]:
raise Exception(
"file: {0} is not an amuse configuration file".format(filename)
f"{label} is not an amuse configuration file"
)
for line in lines:
if "=" in line:
var, value = line.split("=", 1)
if value.startswith("@") and value.endswith("@"):
warnings.warn(
"possible configuration error/ unconfigured variable in"
" {0}".format(filename)
f"possible configuration error/ unconfigured variable in"
f" {label}"
)
cfgvars[var] = value.strip()
return cfgvars

def parse_configmk(filename):
configfile = open(filename, "r")
lines = configfile.readlines()
configfile.close()
return parse_configmk_lines(lines, "file " + filename)

try:
configmk = parse_configmk("config.mk")
Expand Down

0 comments on commit b57c1e2

Please sign in to comment.