Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
adfc856
Got rid of problem_params t_switch and set_switch and have onlye one …
lisawim Jan 12, 2023
421bafe
Log messages + defaults dict for setup
lisawim Jan 12, 2023
c74a9fe
Allowing multiple hook classes now
Jan 12, 2023
6191177
Error estimating convergence controllers will now add hooks to record
Jan 12, 2023
2be53b8
Adhering to python standards for naming classes
Jan 12, 2023
7c33bd0
Forgot to add some files to the commit
Jan 12, 2023
0de2f8d
Added a step size hook
Jan 12, 2023
07750d9
Change switching logic of models using a counter (but yields differen…
lisawim Jan 12, 2023
d027c81
Removed files again..
lisawim Jan 12, 2023
02dc5d4
Adapted controller in project
Jan 12, 2023
226d9dd
Dealt with dangerous business of restarts a little bit
Jan 13, 2023
f14c47d
Changed CI pipeline so use secrets from target repository upon PR
Jan 13, 2023
f6b465e
Added types for `on: pull_request_target`
Jan 13, 2023
4a8a5b6
Reverted previous commit because it didn't help
Jan 13, 2023
653e7e5
New switching logics due to changes in SE
lisawim Jan 13, 2023
91ab723
Added some more tests
lisawim Jan 14, 2023
16ba444
Removed print lines
lisawim Jan 14, 2023
e3b4f9b
Removed counter for switches in SE
lisawim Jan 14, 2023
26546b3
New restarts section in the hooks
lisawim Jan 14, 2023
1475945
Two different hooks for battery, because module for e_embedded cannot…
lisawim Jan 14, 2023
ae684c2
Black, black, black..
lisawim Jan 14, 2023
81d5944
Update ci_pipeline.yml
pancetta Jan 15, 2023
0ae6235
Replaced set_counter by a method flip switches
lisawim Jan 15, 2023
4f601bf
Inheritance for Battery!
lisawim Jan 15, 2023
2acf596
New switching logic
lisawim Jan 15, 2023
a83fa6b
Update ci_pipeline.yml
pancetta Jan 16, 2023
41a1113
Update pyproject.toml
pancetta Jan 16, 2023
5159368
Update README.rst
pancetta Jan 16, 2023
1de8d2f
Update README.rst
pancetta Jan 16, 2023
23976b6
Removing any changes to the CI pipeline from this PR
Jan 16, 2023
66cc5bc
Merge remote-tracking branch 'upstream/master' into controller_restru…
Jan 16, 2023
92a9a1e
Merge pull request #246 from brownbaerchen/controller_restructure
pancetta Jan 16, 2023
e24debc
Update README.rst
pancetta Jan 16, 2023
a055c4d
Status variables, short switching logics and other improvements, than…
lisawim Jan 16, 2023
935b4bb
Solved merge conflict
lisawim Jan 16, 2023
d78106a
Hardcoded references for battery due to @brownbaerchen's suggestion
lisawim Jan 16, 2023
8ec74ef
Hardcoded references for battery_2condensators
lisawim Jan 17, 2023
97b43a9
More detailed description for get_recomputed()
lisawim Jan 17, 2023
a0bedf3
Added total number of iters to hardcoded references
lisawim Jan 17, 2023
e179d2d
Added a battery model with N condensators, removed file Battery_2cond…
lisawim Jan 18, 2023
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
79 changes: 41 additions & 38 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ jobs:
run: |
flakeheaven lint --benchmark pySDC

mirror_to_gitlab:
# mirror_to_gitlab:

runs-on: ubuntu-latest
# runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1
# steps:
# - name: Checkout
# uses: actions/checkout@v1

- name: Mirror
uses: jakob-fritz/github2lab_action@main
env:
MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
GITLAB_PROJECT_ID: "3525"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Mirror
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

user_cpu_tests_linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -121,31 +121,31 @@ jobs:
pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m ${{ matrix.env }}


wait_for_gitlab:
runs-on: ubuntu-latest
# wait_for_gitlab:
# runs-on: ubuntu-latest

needs:
- mirror_to_gitlab
# needs:
# - mirror_to_gitlab

steps:
- name: Wait
uses: jakob-fritz/github2lab_action@main
env:
MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
GITLAB_PROJECT_ID: "3525"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# steps:
# - name: Wait
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Get and prepare artifacts
# run: |
# pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# rm -rf data
# unzip artifacts.zip
# ls -ratl
# # - name: Get and prepare artifacts
# # run: |
# # pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# # job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# # curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# # rm -rf data
# # unzip artifacts.zip
# # ls -ratl


post-processing:
Expand All @@ -156,7 +156,7 @@ jobs:
needs:
- lint
- user_cpu_tests_linux
- wait_for_gitlab
# - wait_for_gitlab

defaults:
run:
Expand Down Expand Up @@ -188,7 +188,10 @@ jobs:
run: |
pip install genbadge[all]
genbadge coverage -i coverage.xml -o htmlcov/coverage-badge.svg


- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

# - name: Generate benchmark report
# uses: pancetta/github-action-benchmark@v1
# if: ${{ (!contains(github.event.head_commit.message, '[CI-no-benchmarks]')) && (github.event_name == 'push') }}
Expand Down
8 changes: 6 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
|badge-ga|
|badge-ossf|
|badge-cc|
|zenodo|

Welcome to pySDC!
=================
Expand Down Expand Up @@ -79,7 +81,9 @@ This project also received funding from the `German Federal Ministry of Educatio
The project also received help from the `Helmholtz Platform for Research Software Engineering - Preparatory Study (HiRSE_PS) <https://www.helmholtz-hirse.de/>`_.


.. |badge-ga| image:: https://github.com/Parallel-in-Time/pySDC/actions/workflows/ci_pipeline.yml/badge.svg
.. |badge-ga| image:: https://github.com/Parallel-in-Time/pySDC/actions/workflows/ci_pipeline.yml/badge.svg?branch=master
:target: https://github.com/Parallel-in-Time/pySDC/actions/workflows/ci_pipeline.yml
.. |badge-ossf| image:: https://bestpractices.coreinfrastructure.org/projects/6909/badge
:target: https://bestpractices.coreinfrastructure.org/projects/6909
:target: https://bestpractices.coreinfrastructure.org/projects/6909
.. |badge-cc| image:: https://codecov.io/gh/Parallel-in-Time/pySDC/branch/master/graph/badge.svg?token=hpP18dmtgS
:target: https://codecov.io/gh/Parallel-in-Time/pySDC
39 changes: 35 additions & 4 deletions pySDC/core/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import sys
import numpy as np

from pySDC.core import Hooks as hookclass
from pySDC.core.BaseTransfer import base_transfer
from pySDC.helpers.pysdc_helper import FrozenClass
from pySDC.implementations.convergence_controller_classes.check_convergence import CheckConvergence
from pySDC.implementations.hooks.default_hook import DefaultHooks


# short helper class to add params as attributes
Expand Down Expand Up @@ -41,10 +41,15 @@ def __init__(self, controller_params, description):
"""

# check if we have a hook on this list. If not, use default class.
controller_params['hook_class'] = controller_params.get('hook_class', hookclass.hooks)
self.__hooks = controller_params['hook_class']()
self.__hooks = []
hook_classes = [DefaultHooks]
user_hooks = controller_params.get('hook_class', [])
hook_classes += user_hooks if type(user_hooks) == list else [user_hooks]
[self.add_hook(hook) for hook in hook_classes]
controller_params['hook_class'] = controller_params.get('hook_class', hook_classes)

self.hooks.pre_setup(step=None, level_number=None)
for hook in self.hooks:
hook.pre_setup(step=None, level_number=None)

self.params = _Pars(controller_params)

Expand Down Expand Up @@ -101,6 +106,20 @@ def __setup_custom_logger(level=None, log_to_file=None, fname=None):
else:
pass

def add_hook(self, hook):
"""
Add a hook to the controller which will be called in addition to all other hooks whenever something happens.
The hook is only added if a hook of the same class is not already present.

Args:
hook (pySDC.Hook): A hook class that is derived from the core hook class

Returns:
None
"""
if hook not in [type(me) for me in self.hooks]:
self.__hooks += [hook()]

def welcome_message(self):
out = (
"Welcome to the one and only, really very astonishing and 87.3% bug free"
Expand Down Expand Up @@ -308,3 +327,15 @@ def get_convergence_controllers_as_table(self, description):
out += f'\n{user_added}|{i:3} | {C.params.control_order:5} | {type(C).__name__}'

return out

def return_stats(self):
"""
Return the merged stats from all hooks

Returns:
dict: Merged stats from all hooks
"""
stats = {}
for hook in self.hooks:
stats = {**stats, **hook.return_stats()}
return stats
Loading