Skip to content

Commit

Permalink
Use CumulativeAnalysisReport.generation.activity when registering in …
Browse files Browse the repository at this point in the history
…Nexus (#6)

Other changes:

- Remove EnsuredList because not needed anymore
- Remove analysis entities already moved to entity-management
- Upgrade requirements.txt, needing entity-management>=1.5.0
  • Loading branch information
GianlucaFicarelli authored Aug 28, 2024
1 parent 46d28c4 commit d1343ea
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 114 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
Changelog
=========

Version 4.1.0 (2024-08-28)
--------------------------

Breaking changes
~~~~~~~~~~~~~~~~

- Use CumulativeAnalysisReport.generation.activity when registering custom analyses in Nexus.

Improvements
~~~~~~~~~~~~

- Upgrade requirements.txt.

Version 4.0.2 (2024-08-23)
--------------------------

Improvements
~~~~~~~~~~~~

- Add generatorName in VariantTaskConfig to obey schema.

Version 4.0.1 (2024-08-15)
--------------------------

Expand Down
20 changes: 11 additions & 9 deletions bbp_workflow/sbo/analysis/common/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
from functools import cached_property
from pathlib import Path

from entity_management.analysis import (
AnalysisReportGeneration,
AnalysisReportGenerationActivity,
AnalysisSoftwareSourceCode,
CumulativeAnalysisReport,
MultiCumulativeAnalysisReport,
)
from entity_management.base import Derivation
from entity_management.core import Contribution
from luigi import (
BoolParameter,
Config,
Expand All @@ -28,11 +34,6 @@
from luigi.parameter import ParameterVisibility

from bbp_workflow.luigi import CompleteTask, RemoteTarget, inherits
from bbp_workflow.sbo.entity import (
AnalysisSoftwareSourceCode,
CumulativeAnalysisReport,
MultiCumulativeAnalysisReport,
)
from bbp_workflow.sbo.task import BaseTask, MetaTask
from bbp_workflow.settings import DEFAULT_HOST, L
from bbp_workflow.slurm import _run_cmd, _run_sbatch, _sbatch
Expand Down Expand Up @@ -534,21 +535,22 @@ def pre_publish_resource(self, activity):
assert isinstance(task, AnalyseGeneric)
if task.source_code_url:
agent = AnalysisSoftwareSourceCode.from_url(task.source_code_url)
contributions = [Contribution(agent=agent)]
generation_activity = AnalysisReportGenerationActivity(wasAssociatedWith=agent)
generations = [AnalysisReportGeneration(activity=generation_activity)]
else:
L.warning(
"The source code url for analysis %s is missing, the relation won't be created",
index,
)
contributions = None
generations = None
sub_resource = CumulativeAnalysisReport(
name=task.report_name,
description=task.report_description,
categories=list(task.categories),
types=list(task.types),
derivation=Derivation(entity=analysed_entity),
index=index,
contribution=contributions,
generation=generations,
)
sub_resource = self.publish(sub_resource, activity=activity)
parts.append(sub_resource)
Expand Down
2 changes: 1 addition & 1 deletion bbp_workflow/sbo/analysis/emodel/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path

from blue_cwl.me_model.staging import stage_emodel
from entity_management.analysis import AnalysisReport, MultiEModelAnalysis
from entity_management.base import Derivation
from entity_management.emodel import EModel
from luigi import DictParameter, ListParameter, Parameter, PathParameter
Expand All @@ -18,7 +19,6 @@
MultiAnalyseGenericMeta,
get_analysis_config_schema,
)
from bbp_workflow.sbo.entity import AnalysisReport, MultiEModelAnalysis
from bbp_workflow.sbo.task import BaseTask
from bbp_workflow.settings import DEFAULT_HOST
from bbp_workflow.task import KgCfg
Expand Down
10 changes: 5 additions & 5 deletions bbp_workflow/sbo/analysis/sim/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
from functools import cached_property
from pathlib import Path

from entity_management.analysis import (
AnalysisReport,
Derivation,
MultiCumulativeSimulationCampaignAnalysis,
)
from entity_management.simulation import Simulation
from luigi import DictParameter, ListParameter, Parameter

Expand All @@ -15,11 +20,6 @@
MultiAnalyseGenericMeta,
get_analysis_config_schema,
)
from bbp_workflow.sbo.entity import (
AnalysisReport,
Derivation,
MultiCumulativeSimulationCampaignAnalysis,
)
from bbp_workflow.sbo.sim.task import RunSimCampaign, RunSimCampaignMeta
from bbp_workflow.settings import L
from bbp_workflow.simulation.util import read_config
Expand Down
2 changes: 1 addition & 1 deletion bbp_workflow/sbo/emodel/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from bluepyemodel.emodel_pipeline.emodel_settings import EModelPipelineSettings
from bluepyemodel.model.model_configurator import ModelConfigurator
from entity_management.core import Entity
from entity_management.workflow import BbpWorkflowActivity
from luigi import Parameter

from bbp_workflow.sbo.entity import BbpWorkflowActivity
from bbp_workflow.sbo.task import BaseTask, MetaTask

L = logging.getLogger(__name__)
Expand Down
79 changes: 0 additions & 79 deletions bbp_workflow/sbo/entity.py

This file was deleted.

3 changes: 2 additions & 1 deletion bbp_workflow/sbo/sim/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from threading import Thread

import numpy as np
from entity_management.analysis import AnalysisReport
from entity_management.base import Derivation
from entity_management.simulation import Simulation as SimEntity
from entity_management.simulation import (
SimulationCampaign,
Expand All @@ -32,7 +34,6 @@

from bbp_workflow.luigi import RemoteTarget, inherits
from bbp_workflow.sbo.circ.task import FindDetailedCircuit, FindDetailedCircuitMeta
from bbp_workflow.sbo.entity import AnalysisReport, Derivation
from bbp_workflow.sbo.task import BaseTask, MetaTask
from bbp_workflow.settings import (
BBP_WORKFLOW_SIF,
Expand Down
3 changes: 2 additions & 1 deletion bbp_workflow/sbo/viz/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pathlib import Path

import brayns
from entity_management.analysis import AnalysisReport
from entity_management.base import Derivation
from entity_management.simulation import Simulation as SimEntity
from entity_management.simulation import SimulationCampaignAnalysis
from luigi import (
Expand All @@ -23,7 +25,6 @@

from bbp_workflow.luigi import RemoteTarget, inherits
from bbp_workflow.sbo.analysis.sim.task import MultiAnalyseSimCampaignMeta
from bbp_workflow.sbo.entity import AnalysisReport, Derivation
from bbp_workflow.sbo.sim.task import ReportsSimCampaignMeta, RunSimCampaign, RunSimCampaignMeta
from bbp_workflow.sbo.task import BaseTask, MetaTask
from bbp_workflow.settings import BBP_WORKFLOW_SIF, BRAYNS_SIF, DEFAULT_HOST, ENVIRONMENT
Expand Down
4 changes: 3 additions & 1 deletion bbp_workflow/simulation/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ def _handle_post_processors(self, config):
if self.post_processors:
sim_indices = _indices_to_ranges(_campaign_sim_indices(config))
path_prefix_name = Path(config.attrs["path_prefix"]) / config.name
cmd = f'python "$POST_PROCESSOR" {path_prefix_name/"config.json"} $SLURM_ARRAY_TASK_ID'
cmd = (
f'python "$POST_PROCESSOR" {path_prefix_name / "config.json"} $SLURM_ARRAY_TASK_ID'
)
pre_cmd = dedent(
f"""\
cd {path_prefix_name}/$SLURM_ARRAY_TASK_ID
Expand Down
31 changes: 15 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile
Expand Down Expand Up @@ -27,15 +27,15 @@ bluepyefe==2.3.34
# via bluepyemodel
bluepyemodel==1.0.15
# via bbp-workflow (setup.py)
bluepyopt==1.14.13
bluepyopt==1.14.15
# via bluepyemodel
bluepysnap==3.0.1
# via
# bbp-workflow (setup.py)
# brainbuilder
brainbuilder==0.20.1
# via blue-cwl
brayns==3.8.3
brayns==3.9.0
# via bbp-workflow (setup.py)
cached-property==1.5.2
# via
Expand Down Expand Up @@ -63,9 +63,9 @@ click==8.1.7
# neurom
comm==0.2.2
# via ipykernel
configparser==7.0.0
configparser==7.1.0
# via bluepyemodel
contourpy==1.2.1
contourpy==1.3.0
# via matplotlib
cryptography==43.0.0
# via jwcrypto
Expand All @@ -89,14 +89,14 @@ devtools[pygments]==0.12.2
# via entity-management
docutils==0.21.2
# via python-daemon
efel==5.7.6
efel==5.7.8
# via
# bluepyefe
# bluepyemodel
# bluepyopt
elephant==1.1.0
# via bbp-workflow (setup.py)
entity-management==1.4.1
entity-management==1.5.0
# via
# bbp-workflow (setup.py)
# blue-cwl
Expand Down Expand Up @@ -136,16 +136,16 @@ hdmf==3.14.3
# via pynwb
httpcore==1.0.5
# via httpx
httpx==0.27.0
httpx==0.27.2
# via python-keycloak
idna==3.7
idna==3.8
# via
# anyio
# httpx
# requests
igor2==0.5.8
# via bluepyefe
importlib-resources==6.4.2
importlib-resources==6.4.4
# via bluepysnap
ipykernel==6.29.5
# via ipyparallel
Expand Down Expand Up @@ -364,7 +364,7 @@ pynrrd==1.0.0
# via voxcell
pynwb==2.8.1
# via efel
pyparsing==3.1.2
pyparsing==3.1.4
# via
# matplotlib
# rdflib
Expand All @@ -389,12 +389,12 @@ pyyaml==6.0.2
# brainbuilder
# fz-td-recipe
# neurom
pyzmq==26.1.0
pyzmq==26.2.0
# via
# ipykernel
# ipyparallel
# jupyter-client
quantities==0.15.0
quantities==0.16.0
# via
# elephant
# neo
Expand Down Expand Up @@ -422,7 +422,7 @@ ruamel-yaml==0.18.6
# via hdmf
ruamel-yaml-clib==0.2.8
# via ruamel-yaml
scipy==1.14.0
scipy==1.14.1
# via
# bluepyefe
# bluepyemodel
Expand Down Expand Up @@ -480,7 +480,6 @@ typing-extensions==4.12.2
# efel
# flexcache
# flexparser
# ipython
# jwcrypto
# luigi-tools
# pint
Expand All @@ -498,7 +497,7 @@ voxcell==3.1.9
# brainbuilder
wcwidth==0.2.13
# via prompt-toolkit
websockets==12.0
websockets==13.0
# via brayns
xarray==2024.7.0
# via
Expand Down

0 comments on commit d1343ea

Please sign in to comment.