Skip to content

Commit

Permalink
Mark final summarize jobs complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Oct 31, 2024
1 parent 5534954 commit fa71263
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 2 deletions.
6 changes: 6 additions & 0 deletions hoomd_validation/alj_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import math
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -450,13 +451,18 @@ def plot(*, ax, data, quantity_name, legend=False):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the job complete
for job in jobs:
Path(job.fn('conservation_analyze_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.conservation_analyze',
Action(
method=conservation_analyze,
configuration={
'previous_actions': nve_md_sampling_jobs,
'products': ['conservation_analyze_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/hard_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import json
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -795,13 +796,18 @@ def compare_modes(*jobs):
filename = f'hard_disk_compare_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/hard_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import itertools
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -651,13 +652,18 @@ def compare_modes(*jobs):
filename = f'hard_sphere_compare_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
16 changes: 16 additions & 0 deletions hoomd_validation/lj_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import math
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -1076,13 +1077,18 @@ def compare_modes(*jobs):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1241,13 +1247,18 @@ def distribution_analyze(*jobs):
)
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('distribution_analyze_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.distribution_analyze',
Action(
method=distribution_analyze,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['distribution_analyze_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1472,13 +1483,18 @@ def plot(*, ax, data, quantity_name, legend=False):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('conservation_analyze_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.conservation_analyze',
Action(
method=conservation_analyze,
configuration={
'previous_actions': nve_md_sampling_jobs,
'products': ['conservation_analyze_complete'],
'group': _group_compare | _include_nve,
'resources': {
'processes': {'per_submission': 1},
Expand Down
16 changes: 16 additions & 0 deletions hoomd_validation/lj_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import math
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -1095,13 +1096,18 @@ def compare_modes(*jobs):
filename = f'lj_union_compare_kT{kT}_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1301,13 +1307,18 @@ def distribution_analyze(*jobs):
)
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('distribution_analyze_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.distribution_analyze',
Action(
method=distribution_analyze,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['distribution_analyze_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down Expand Up @@ -1528,13 +1539,18 @@ def plot(*, ax, data, quantity_name, legend=False):

fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('conservation_analyze_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.conservation_analyze',
Action(
method=conservation_analyze,
configuration={
'previous_actions': nve_md_sampling_jobs,
'products': ['conservation_analyze_complete'],
'group': _group_compare | _include_nve,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/patchy_particle_pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import json
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -807,13 +808,18 @@ def compare_modes(*jobs):
transparent=False,
)

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
6 changes: 6 additions & 0 deletions hoomd_validation/simple_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import json
import os
from pathlib import Path

try:
import hoomd
Expand Down Expand Up @@ -659,13 +660,18 @@ def compare_modes(*jobs):
filename = f'simple_polygon_compare_density{round(set_density, 2)}.svg'
fig.savefig(os.path.join(jobs[0]._project.path, filename), bbox_inches='tight')

# mark the action complete
for job in jobs:
Path(job.fn('compare_modes_complete').touch())


ValidationWorkflow.add_action(
f'{__name__}.compare_modes',
Action(
method=compare_modes,
configuration={
'previous_actions': [f'{__name__}.analyze'],
'products': ['compare_modes_complete'],
'group': _group_compare,
'resources': {
'processes': {'per_submission': 1},
Expand Down
8 changes: 6 additions & 2 deletions hoomd_validation/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import argparse
import subprocess
import warnings
from pathlib import Path

import rtoml
Expand Down Expand Up @@ -77,6 +78,9 @@ def add_action(cls, name, action):
message = f'Action {name} cannot be added twice.'
raise ValueError(message)

if 'products' not in action._configuration:
warnings.warn(f"Action {name} is missing products.", stacklevel=2)

cls._actions[name] = action

@classmethod
Expand Down Expand Up @@ -138,10 +142,10 @@ def main(cls, init=None, init_args=None, **kwargs):
as options to the ``init`` subparser with ``add_argument``.
Args:
init(callable): User-provided initializaiton routine. Must take one
init(callable): User-provided initialization routine. Must take one
argument: ``args`` - the ``argparse`` parsed arguments.
init_args(list[str]): List of args to add to the ``init`` subparser.
**kwargs: Fowarded to `make_workflow`.
**kwargs: Forwarded to `make_workflow`.
"""
parser = argparse.ArgumentParser()
command = parser.add_subparsers(dest='command', required=True)
Expand Down

0 comments on commit fa71263

Please sign in to comment.