Skip to content

Commit

Permalink
Support for signac 2 (#710)
Browse files Browse the repository at this point in the history
* Initial refactoring for signac 2.0.

* Replace signac.contrib usage.

* Remove project names.

* Fix config overrides, use string types for config value tests.

* Test against git HEAD of signac.

* Fix condition evaluation test.

* Use project.path instead of project.config.project_dir.

* Update mocking since project.config.project_dir no longer exists.

* Update pyproject.toml

---------

Co-authored-by: Hardik Ojha <[email protected]>
  • Loading branch information
bdice and kidrahahjo authored Mar 30, 2023
1 parent c3b1d99 commit 0e5a8b6
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 109 deletions.
24 changes: 10 additions & 14 deletions flow/aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def foo(*jobs):
The method by which jobs are grouped. It may be a state point key
or an iterable of state point keys whose values define the
groupings. It may also be an arbitrary callable of
:class:`~signac.contrib.job.Job` when greater flexibility is
:class:`~signac.job.Job` when greater flexibility is
needed.
default : Any
Default value used for grouping if the key is missing or invalid.
Expand Down Expand Up @@ -318,7 +318,7 @@ def _create_AggregateStore(self, project):
Parameters
----------
project : :class:`signac.contrib.project.Project`
project : :class:`signac.Project`
A signac project used to fetch jobs for creating aggregates.
Returns
Expand All @@ -338,7 +338,7 @@ class _BaseAggregateStore(Mapping):
An aggregate store is a mapping from aggregate ids to aggregates, where
an aggregate is defined as a tuple of instances of
:class:`signac.contrib.job.Job`.
:class:`signac.job.Job`.
"""

def __init__(self, project):
Expand All @@ -358,7 +358,7 @@ class _AggregateStore(_BaseAggregateStore):
----------
aggregator : :class:`aggregator`
aggregator object used to generate aggregates for this store.
project : :class:`flow.FlowProject` or :class:`signac.contrib.project.Project`
project : :class:`flow.FlowProject` or :class:`signac.Project`
A signac project containing the jobs that will be used to create
aggregates.
Expand Down Expand Up @@ -477,7 +477,7 @@ class _DefaultAggregateStore(_BaseAggregateStore):
Parameters
----------
project : :class:`flow.FlowProject` or :class:`signac.contrib.project.Project`
project : :class:`flow.FlowProject` or :class:`signac.Project`
A signac project used to fetch jobs for creating aggregates.
"""
Expand Down Expand Up @@ -560,7 +560,7 @@ def get_aggregate_id(aggregate):
Parameters
----------
aggregate : tuple of :class:`~signac.contrib.job.Job`
aggregate : tuple of :class:`~signac.job.Job`
Aggregate of signac jobs.
Returns
Expand Down Expand Up @@ -637,17 +637,13 @@ class _JobAggregateCursor(_AggregatesCursor):
----------
project : :class:`~.FlowProject`
A FlowProject whose jobs are aggregated.
filter : dict
A mapping of key-value pairs that all indexed job state points are
compared against (Default value = None).
doc_filter : dict
A mapping of key-value pairs that all indexed job documents are
compared against (Default value = None).
filter : Mapping, optional
A mapping of key-value pairs used for the query (Default value = None).
"""

def __init__(self, project, filter=None, doc_filter=None):
self._cursor = project.find_jobs(filter, doc_filter)
def __init__(self, project, filter=None):
self._cursor = project.find_jobs(filter)

def __eq__(self, other):
# Cursors cannot compare equal if one is over aggregates and the other
Expand Down
4 changes: 2 additions & 2 deletions flow/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def update(self, other, aggregate=False, jobs=None, parallel=False):
The other set of directives.
aggregate : bool
Whether to combine directives according to serial/parallel rules.
jobs : :class:`signac.contrib.job.Job` or tuple of :class:`signac.contrib.job.Job`
jobs : :class:`signac.job.Job` or tuple of :class:`signac.job.Job`
The jobs used to evaluate directives.
parallel : bool
Whether to aggregate according to parallel rules.
Expand All @@ -218,7 +218,7 @@ def evaluate(self, jobs):
Parameters
----------
jobs : :class:`signac.contrib.job.Job` or tuple of :class:`signac.contrib.job.Job`
jobs : :class:`signac.job.Job` or tuple of :class:`signac.job.Job`
The jobs used to evaluate directives.
"""
Expand Down
Loading

0 comments on commit 0e5a8b6

Please sign in to comment.