Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/conda_env/environment_static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: ips_static_analysis
channels:
- conda-forge
dependencies:
- python=3.9
- ruff=0.9.4
- python=3.10
- ruff=0.16.0
#- flake8=5.0.4
#- pylint=2.15.3
#- bandit=1.7.4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ www/
log
resource_usage
work/
ENSEMBLES

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
16 changes: 8 additions & 8 deletions components/drivers/hello/hello_worker_task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from time import asctime, sleep


def myFun(*args):
print(f"{asctime()} : Running myFUN {args}")
def my_fun(*args):
print(f"{asctime()} : Running my_fun {args}")
sleep(int(args[0]))
print(f"{asctime()} : Finished myFUN {args}")
print(f"{asctime()} : Finished my_fun {args}")
return 0


Expand Down Expand Up @@ -46,10 +46,10 @@ def step(self, timeStamp=0.0):
logfile=f"task_{i}.log",
task_env=task_env)
self.services.add_task('pool', 'method_'+str(i), 1,
cwd, copy.copy(self).myMethod, str(duration[i]),
cwd, copy.copy(self).my_method, str(duration[i]),
task_env=task_env)
self.services.add_task('pool', 'function_' + str(i), 1,
cwd, myFun, str(duration[i]),
cwd, my_fun, str(duration[i]),
task_env=task_env)

ret_val = self.services.submit_tasks('pool', use_dask=True, dask_nodes=1, dask_ppw=10)
Expand Down Expand Up @@ -79,10 +79,10 @@ def step(self, timeStamp=0.0):

return

def myMethod(self, *args):
print(f"{asctime()} : Running myMethod {args} self.BIN_PATH = {self.BIN_PATH}")
def my_method(self, *args):
print(f"{asctime()} : Running my_method {args} self.BIN_PATH = {self.BIN_PATH}")
sleep(int(args[0]))
print(f"{asctime()} : Finished myMethod {args} self.BIN_PATH = {self.BIN_PATH}")
print(f"{asctime()} : Finished my_method {args} self.BIN_PATH = {self.BIN_PATH}")
return 0

def finalize(self, timeStamp=0.0):
Expand Down
28 changes: 14 additions & 14 deletions doc/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,29 +104,29 @@ and the output will look like
ipsframework/__init__.py 11 0 100%
ipsframework/cca_es_spec.py 62 10 84%
ipsframework/component.py 105 19 82%
ipsframework/componentRegistry.py 105 25 76%
ipsframework/configurationManager.py 510 103 80%
ipsframework/component_registry.py 105 25 76%
ipsframework/configuration_manager.py 510 103 80%
ipsframework/convert_log_function.py 29 1 97%
ipsframework/dataManager.py 72 15 79%
ipsframework/data_manager.py 72 15 79%
ipsframework/debug.py 3 0 100%
ipsframework/eventService.py 137 53 61%
ipsframework/eventServiceProxy.py 118 49 58%
ipsframework/event_service.py 137 53 61%
ipsframework/event_service_proxy.py 118 49 58%
ipsframework/ips.py 360 51 86%
ipsframework/ipsExceptions.py 61 2 97%
ipsframework/ipsLogging.py 92 8 91%
ipsframework/ips_exceptions.py 61 2 97%
ipsframework/ips_logging.py 92 8 91%
ipsframework/ips_es_spec.py 43 7 84%
ipsframework/ipsutil.py 73 26 64%
ipsframework/messages.py 58 0 100%
ipsframework/node_structure.py 193 31 84%
ipsframework/platformspec.py 18 4 78%
ipsframework/portalBridge.py 205 36 82%
ipsframework/resourceHelper.py 304 59 81%
ipsframework/resourceManager.py 340 69 80%
ipsframework/runspaceInitComponent.py 88 31 65%
ipsframework/sendPost.py 41 2 95%
ipsframework/portal_bridge.py 205 36 82%
ipsframework/resource_helper.py 304 59 81%
ipsframework/resource_manager.py 340 69 80%
ipsframework/runspace_init_component.py 88 31 65%
ipsframework/send_post.py 41 2 95%
ipsframework/services.py 1200 234 80%
ipsframework/taskManager.py 322 74 77%
ipsframework/topicManager.py 59 5 92%
ipsframework/task_manager.py 322 74 77%
ipsframework/topic_manager.py 59 5 92%
-----------------------------------------------------------
TOTAL 4609 914 80%

Expand Down
12 changes: 6 additions & 6 deletions doc/examples/dask/dask_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from ipsframework import Component


def myFun(*args):
print(f"myFun({args[0]})")
def my_fun(*args):
print(f"my_fun({args[0]})")
sleep(float(args[0]))
return 0

Expand All @@ -16,8 +16,8 @@ def step(self, timestamp=0.0):

duration = 0.5
self.services.add_task('pool', 'binary', 1, cwd, self.EXECUTABLE, duration)
self.services.add_task('pool', 'function', 1, cwd, myFun, duration)
self.services.add_task('pool', 'method', 1, cwd, copy.copy(self).myMethod, duration)
self.services.add_task('pool', 'function', 1, cwd, my_fun, duration)
self.services.add_task('pool', 'method', 1, cwd, copy.copy(self).my_method, duration)

ret_val = self.services.submit_tasks('pool',
use_dask=True,
Expand All @@ -26,7 +26,7 @@ def step(self, timestamp=0.0):
exit_status = self.services.get_finished_tasks('pool')
print('exit_status = ', exit_status)

def myMethod(self, *args):
print(f"myMethod({args[0]})")
def my_method(self, *args):
print(f"my_method({args[0]})")
sleep(float(args[0]))
return 0
2 changes: 1 addition & 1 deletion doc/examples/dask/simulation_log.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"code": "DASK_WORKER__DaskWorker",
"eventtype": "IPS_LAUNCH_DASK_TASK",
"walltime": "2.33",
"comment": "task_name = function, Target = myFun(0.5)",
"comment": "task_name = function, Target = my_fun(0.5)",
}
{
"code": "DASK_WORKER__DaskWorker",
Expand Down
6 changes: 2 additions & 4 deletions doc/examples/ensembles/a_comp.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env python3
""" Component wrapper for the ensemble example for `a_sim`. """
from ipsframework import Component
from ipsframework.resourceHelper import get_platform_info
from ipsframework.resource_helper import get_platform_info

class a_comp(Component):
class AComp(Component):
def __init__(self, services, config):
super().__init__(services, config)
print('Created %s' % (self.__class__))
Expand All @@ -17,4 +16,3 @@ def step(self, timestamp=0.0):

run_env = get_platform_info()
self.services.info(run_env)

7 changes: 3 additions & 4 deletions doc/examples/ensembles/another_comp.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/env python3
""" Component wrapper for the ensemble example for `another_sim`. """
from ipsframework import Component
from ipsframework.resourceHelper import get_platform_info
from ipsframework.resource_helper import get_platform_info


class another_comp(Component):
class AnotherComp(Component):
def __init__(self, services, config):
super().__init__(services, config)
print('Created %s' % (self.__class__))
Expand All @@ -17,4 +16,4 @@ def step(self, timestamp=0.0):
print(f'another_comp parameters: D={self.D}, B={self.B}, F={self.F}')

run_env = get_platform_info()
self.services.info(run_env)
self.services.info(run_env)
4 changes: 1 addition & 3 deletions doc/examples/ensembles/driver.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SIMULATION_MODE = NORMAL
BIN_PATH = $SRC_DIR/IPS-framework/doc/examples/ensembles/
CLASS = driver
SUB_CLASS =
NAME = ensemble_driver
NAME = EnsembleDriver
SCRIPT = ${BIN_PATH}/driver.py
NPROC = 1
# Ensures we can find this file for run_ensembles call.
Expand All @@ -26,5 +26,3 @@ SIMULATION_MODE = NORMAL
INPUT_FILES = template.config
OUTPUT_FILES =
RESTART_FILES =


12 changes: 5 additions & 7 deletions doc/examples/ensembles/driver.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
#!/usr/bin/env python3
"""
Example driver for the ensembles example.
Example Driver for the ensembles example.

Please note that run_ensemble can be run from any IPS component, not
just a driver. The driver is used here for simplicity.
just a Driver. The Driver is used here for simplicity.
"""
import os
from pathlib import Path

from ipsframework import Component


class ensemble_driver(Component):
class EnsembleDriver(Component):

def __init__(self, services, config):
super().__init__(services, config)
print('Creating driver')
print('Creating Driver')

def init(self, timeStamp=0.0):
return
Expand Down Expand Up @@ -51,7 +50,7 @@ def step(self, timestamp=0.0, **keywords):
# variable values. `mapping` is a data struct that associates the
# specific simulation to a given run directory so that the user can
# easily find output for a specific run. Note that "template.config"
# is in INPUT_FILE for the driver component so that it is copied to the run.
# is in INPUT_FILE for the Driver component so that it is copied to the run.
# But, of course, you could also use a full path to the file, instead.
mapping = self.services.run_ensemble('template.config', variables,
'/tmp/IPS', name="EXAMPLE_",
Expand All @@ -62,4 +61,3 @@ def step(self, timestamp=0.0, **keywords):

def finalize(self, timeStamp=0.0):
return

1 change: 0 additions & 1 deletion doc/examples/ensembles/environment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
""" Provides information about the runtime environment

"""
Expand Down
12 changes: 5 additions & 7 deletions doc/examples/ensembles/instance_driver.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/usr/bin/env python3
"""
Example driver for the ensembles example.
Example Driver for the ensembles example.

Please note that run_ensemble can be run from any IPS component, not
just a driver. The driver is used here for simplicity.
just a Driver. The Driver is used here for simplicity.
"""
from ipsframework import Component


class instance_driver(Component):
class InstanceDriver(Component):

def __init__(self, services, config):
super().__init__(services, config)
print('Creating instance driver')
print('Creating instance Driver')

def init(self, timeStamp=0.0):
return
Expand All @@ -22,7 +21,7 @@ def step(self, timestamp=0.0, **keywords):

In this example we have two components for an
example coupled simulation. The components are
'a_sim_comp' and 'another_sim_comp'. Here, we step
'ASimComp' and 'AnotherSimComp'. Here, we step
each of those components where they echo their
unique parameters.
"""
Expand All @@ -35,4 +34,3 @@ def step(self, timestamp=0.0, **keywords):
self.services.call(another_comp, 'step', 0.0)

self.services.info('Finished stepping components')

6 changes: 3 additions & 3 deletions doc/examples/ensembles/template.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SRC_DIR = /Users/may/Projects/IPS
BIN_PATH = $SRC_DIR/IPS-framework/doc/examples/ensembles/
CLASS = driver
SUB_CLASS =
NAME = instance_driver
NAME = InstanceDriver
SCRIPT = ${BIN_PATH}/instance_driver.py
NPROC = 1
INPUT_FILES =
Expand All @@ -36,7 +36,7 @@ SRC_DIR = /Users/may/Projects/IPS
BIN_PATH = $SRC_DIR/IPS-framework/doc/examples/ensembles/
CLASS = workers
SUB_CLASS =
NAME = a_comp
NAME = AComp
SCRIPT = ${BIN_PATH}/a_comp.py
NPROC = 1
INPUT_FILES =
Expand All @@ -51,7 +51,7 @@ SRC_DIR = /Users/may/Projects/IPS
BIN_PATH = $SRC_DIR/IPS-framework/doc/examples/ensembles/
CLASS = workers
SUB_CLASS =
NAME = another_comp
NAME = AnotherComp
SCRIPT = ${BIN_PATH}/another_comp.py
NPROC = 1
INPUT_FILES =
Expand Down
4 changes: 2 additions & 2 deletions doc/examples/helloworld.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SIMULATION_MODE = NORMAL
[hello_world_driver]
CLASS = driver
SUB_CLASS =
NAME = hello_driver
NAME = HelloDriver
NPROC = 1
BIN_PATH =
INPUT_FILES =
Expand All @@ -26,7 +26,7 @@ SIMULATION_MODE = NORMAL
[hello_world]
CLASS = workers
SUB_CLASS =
NAME = hello_worker
NAME = HelloWorker
NPROC = 1
BIN_PATH =
INPUT_FILES =
Expand Down
6 changes: 3 additions & 3 deletions doc/examples/helloworld/helloworld/hello_driver.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from ipsframework import Component


class hello_driver(Component):
class HelloDriver(Component):
def __init__(self, services, config):
super().__init__(services, config)
print('Created %s' % (self.__class__))

def step(self, timestamp=0.0):
print('hello_driver: beginning step call')
print('HelloDriver: beginning step call')
worker_comp = self.services.get_port('WORKER')
self.services.call(worker_comp, 'step', 0.0)
print('hello_driver: finished step call')
print('HelloDriver: finished step call')
4 changes: 2 additions & 2 deletions doc/examples/helloworld/helloworld/hello_worker.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from ipsframework import Component


class hello_worker(Component):
class HelloWorker(Component):
def __init__(self, services, config):
super().__init__(services, config)
print('Created %s' % (self.__class__))

def step(self, timestamp=0.0):
print('Hello from hello_worker')
print('Hello from HelloWorker')
1 change: 0 additions & 1 deletion doc/examples/helloworld/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
from setuptools import setup, find_packages

setup(
Expand Down
Loading
Loading