Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
binary_c-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Izzard, Robert Dr (Maths & Physics)
binary_c-python
Commits
d03a3c6e
Commit
d03a3c6e
authored
5 years ago
by
David Hendriks
Browse files
Options
Downloads
Patches
Plain Diff
old updates. not sure what changed
parent
208a9644
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
binarycpython/utils/grid.py
+47
-1
47 additions, 1 deletion
binarycpython/utils/grid.py
binarycpython/utils/grid_options_defaults.py
+6
-2
6 additions, 2 deletions
binarycpython/utils/grid_options_defaults.py
with
53 additions
and
3 deletions
binarycpython/utils/grid.py
+
47
−
1
View file @
d03a3c6e
...
@@ -8,10 +8,12 @@ but copying functionality isn't recommended except if you know what you are doin
...
@@ -8,10 +8,12 @@ but copying functionality isn't recommended except if you know what you are doin
"""
"""
import
os
import
os
import
sys
import
copy
import
copy
import
json
import
json
import
datetime
import
datetime
import
time
import
time
import
logging
import
argparse
import
argparse
import
importlib.util
import
importlib.util
...
@@ -20,7 +22,6 @@ from pathos.helpers import mp as pathos_multiprocess
...
@@ -20,7 +22,6 @@ from pathos.helpers import mp as pathos_multiprocess
# from pathos.multiprocessing import ProcessingPool as Pool
# from pathos.multiprocessing import ProcessingPool as Pool
from
pathos.pools
import
_ProcessPool
as
Pool
from
pathos.pools
import
_ProcessPool
as
Pool
from
binarycpython.utils.grid_options_defaults
import
grid_options_defaults_dict
from
binarycpython.utils.grid_options_defaults
import
grid_options_defaults_dict
from
binarycpython.utils.custom_logging_functions
import
(
from
binarycpython.utils.custom_logging_functions
import
(
autogen_C_logging_code
,
autogen_C_logging_code
,
...
@@ -1381,6 +1382,51 @@ class Population:
...
@@ -1381,6 +1382,51 @@ class Population:
"""
"""
self
.
grid_options
[
"
count
"
]
+=
1
self
.
grid_options
[
"
count
"
]
+=
1
def
set_loggers
(
self
):
"""
Function to set the loggers for the execution of the grid
"""
# Set logfile
binary_c_logfile
=
self
.
grid_options
[
"
log_file
"
]
# Create directory
os
.
makedirs
(
os
.
path
.
dirname
(
binary_c_logfile
),
exist_ok
=
True
)
# Set up logger
self
.
logger
=
logging
.
getLogger
(
'
binary_c_python_logger
'
)
self
.
logger
.
setLevel
(
self
.
grid_options
[
"
verbose
"
])
# Reset handlers
self
.
logger
.
handlers
=
[]
# Set formatting of output
log_formatter
=
logging
.
Formatter
(
'
%(asctime)s - %(name)s - %(levelname)s - %(message)s
'
)
# Make and add filehandlers
# make handler for output to file
handler_file
=
logging
.
FileHandler
(
filename
=
os
.
path
.
join
(
binary_c_logfile
)
)
handler_file
.
setFormatter
(
log_formatter
)
handler_file
.
setLevel
(
logging
.
INFO
)
# Make handler for output to stdout
handler_stdout
=
logging
.
StreamHandler
(
sys
.
stdout
)
handler_stdout
.
setFormatter
(
log_formatter
)
handler_stdout
.
setLevel
(
logging
.
INFO
)
# Add the loggers
self
.
logger
.
addHandler
(
handler_file
)
self
.
logger
.
addHandler
(
handler_stdout
)
# def join_result_dicts(self):
# def join_result_dicts(self):
# """
# """
# Function to join the result dictionaries
# Function to join the result dictionaries
...
...
This diff is collapsed.
Click to expand it.
binarycpython/utils/grid_options_defaults.py
+
6
−
2
View file @
d03a3c6e
...
@@ -11,13 +11,17 @@ grid_options_defaults_dict = {
...
@@ -11,13 +11,17 @@ grid_options_defaults_dict = {
# general (or unordered..)
# general (or unordered..)
##########################
##########################
"
amt_cores
"
:
1
,
# total amount of cores used to evolve the population
"
amt_cores
"
:
1
,
# total amount of cores used to evolve the population
"
verbose
"
:
0
,
# Level of verbosity of the simulation
"
binary
"
:
0
,
# FLag on whether the systems are binary systems or single systems.
"
binary
"
:
0
,
# FLag on whether the systems are binary systems or single systems.
"
parse_function
"
:
None
,
# FUnction to parse the output with.
"
parse_function
"
:
None
,
# FUnction to parse the output with.
"
tmp_dir
"
:
temp_dir
(),
# Setting the temp dir of the program
"
tmp_dir
"
:
temp_dir
(),
# Setting the temp dir of the program
"
main_pid
"
:
-
1
,
# Placeholder for the main process id of the run.
"
main_pid
"
:
-
1
,
# Placeholder for the main process id of the run.
# "output_dir":
# "output_dir":
##########################
##########################
# Execution log:
##########################
"
verbose
"
:
0
,
# Level of verbosity of the simulation. 0=INFO,
"
log_file
"
:
os
.
path
.
join
(
temp_dir
(),
'
binary_c_python.log
'
),
# Set to None to not log to file. The directory will be created
##########################
# binary_c files
# binary_c files
##########################
##########################
"
binary_c_executable
"
:
os
.
path
.
join
(
"
binary_c_executable
"
:
os
.
path
.
join
(
...
@@ -43,7 +47,7 @@ grid_options_defaults_dict = {
...
@@ -43,7 +47,7 @@ grid_options_defaults_dict = {
# Store pre-loading:
# Store pre-loading:
##########################
##########################
"
store_memaddr
"
:
-
1
,
# Contains the store object memory adress, useful for preloading.
"
store_memaddr
"
:
-
1
,
# Contains the store object memory adress, useful for preloading.
# defaults to -1 and isnt used if thats the default then.
# defaults to -1 and isnt used if thats the default then.
##########################
##########################
# Log args: logging of arguments
# Log args: logging of arguments
##########################
##########################
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment