easyvvuq.db.base

Provides a base class for CampaignDBs

  1"""Provides a base class for CampaignDBs
  2
  3"""
  4
  5__copyright__ = """
  6
  7    Copyright 2018 Robin A. Richardson, David W. Wright
  8
  9    This file is part of EasyVVUQ
 10
 11    EasyVVUQ is free software: you can redistribute it and/or modify
 12    it under the terms of the Lesser GNU General Public License as published by
 13    the Free Software Foundation, either version 3 of the License, or
 14    (at your option) any later version.
 15
 16    EasyVVUQ is distributed in the hope that it will be useful,
 17    but WITHOUT ANY WARRANTY; without even the implied warranty of
 18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 19    Lesser GNU General Public License for more details.
 20
 21    You should have received a copy of the Lesser GNU General Public License
 22    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 23
 24"""
 25__license__ = "LGPL"
 26
 27
 28class BaseCampaignDB:
 29    """Baseclass for all EasyVVUQ CampaignDBs
 30
 31    Skeleton for class that provides database access for the campaign.
 32
 33    Parameters
 34    ----------
 35    location: str or None
 36        Location to look for database.
 37    new_campaign: bool
 38        Does the database need to be initialised as a new campaign.
 39    name: str or None
 40        Name of the campaign.
 41    info: `easyvvuq.data_structs.CampaignInfo`
 42        Information defining the campaign.
 43    """
 44
 45    def __init__(self, location=None, new_campaign=False, name=None, info=None):
 46        pass
 47
 48    def app(self, name):
 49        """
 50        Get app information. Specific applications selected by `name`,
 51        otherwise first entry in database 'app' selected.
 52
 53        Parameters
 54        ----------
 55        name : str or None
 56            Name of selected app, if `None` given then first app will be
 57            selected.
 58
 59        Returns
 60        -------
 61        dict:
 62            Application information.
 63        """
 64
 65        raise NotImplementedError
 66
 67    def add_app(self, app_info):
 68        """
 69        Add application to the 'app' table.
 70
 71        Parameters
 72        ----------
 73        app_info: AppInfo
 74            Application definition.
 75
 76        Returns
 77        -------
 78
 79        """
 80
 81        raise NotImplementedError
 82
 83    def add_sampler(self, sampler):
 84        """
 85        Add new Sampler to the 'sampler' table.
 86
 87        Parameters
 88        ----------
 89        sampler: BaseSamplingElement
 90
 91        Returns
 92        -------
 93
 94        """
 95
 96        raise NotImplementedError
 97
 98    def update_sampler(self, sampler_id, sampler_element):
 99        """
100        Update the state of the Sampler with id 'sampler_id' to
101        that in the passed 'sampler_element'
102
103        Parameters
104        ----------
105        sampler_id: int
106            The id of the sampler in the db to update
107        sampler_element: BaseSamplingElement
108            The sampler whose state should be used as the new state
109
110        Returns
111        -------
112
113        """
114
115        raise NotImplementedError
116
117    def resurrect_sampler(self, sampler_id):
118        """
119        Return the sampler object corresponding to id sampler_id in the database.
120        It is deserialized from the state stored in the database.
121
122        Parameters
123        ----------
124        sampler_id: int
125            The id of the sampler to resurrect
126
127        Returns
128        -------
129        BaseSamplingElement
130            The 'live' sampler object, deserialized from the state in the db
131
132        """
133
134        raise NotImplementedError
135
136    def resurrect_app(self, app_name):
137        """
138        Return the 'live' encoder and decoder objects corresponding to the app with
139        name 'app_name' in the database. They are deserialized from the states
140        previously stored in the database.
141
142        Parameters
143        ----------
144        app_name: string
145            Name of the app to resurrect
146
147        Returns
148        -------
149        BaseEncoder, BaseDecoder, BaseCollationElement
150            The 'live' encoder and decoder objects associated with this app
151
152        """
153
154        raise NotImplementedError
155
156    def add_run(self, run_info=None, prefix='Run_'):
157        """
158        Add run to the `runs` table in the database.
159
160        Parameters
161        ----------
162        run_info: `easyvvuq.data_structs.RunInfo`
163            Contains relevant run fields: params, status (where in the
164            EasyVVUQ workflow is this RunTable), campaign (id number),
165            sample, app
166        prefix: str
167            Prefix for run id
168
169        Returns
170        -------
171
172        """
173
174        raise NotImplementedError
175
176    def set_dir_for_run(self, run_name, run_dir, campaign=None, sampler=None):
177        """
178        Set the 'run_dir' path for the specified run in the database.
179
180        Parameters
181        ----------
182        run_name: str
183            Name of run to filter for.
184        run_dir: str
185            Directory path associated to set for this run.
186        campaign:  int or None
187            Campaign id to filter for.
188        sampler: int or None
189            Sample id to filter for.
190
191        Returns
192        -------
193
194        """
195
196        raise NotImplementedError
197
198    def run(self, run_name, campaign=None, sampler=None):
199        """
200        Get the information for a specified run.
201
202        Parameters
203        ----------
204        run_name: str
205            Name of run to filter for.
206        campaign:  int or None
207            Campaign id to filter for.
208        sampler: int or None
209            Sample id to filter for.
210
211        Returns
212        -------
213        dict
214            Containing run information (run_name, params, status, sample,
215            campaign, app)
216        """
217        raise NotImplementedError
218
219    def campaigns(self):
220        """Get list of campaigns for which information is stored in the
221        database.
222
223        Returns
224        -------
225        list:
226            Campaign names.
227        """
228
229        raise NotImplementedError
230
231    def campaign_dir(self, campaign_name=None):
232        """Get campaign directory for `campaign_name`.
233
234        Returns
235        -------
236        str:
237            Path to campaign directory.
238        """
239
240        raise NotImplementedError
241
242    def runs(self, campaign=None, sampler=None, status=None, not_status=None):
243        """
244        A generator to return all run information for selected `campaign` and `sampler`.
245
246        Parameters
247        ----------
248        campaign: int or None
249            Campaign id to filter for.
250        sampler: int or None
251            Sampler id to filter for.
252        status: enum(Status) or None
253            Status string to filter for.
254        not_status: enum(Status) or None
255            Exclude runs with this status string
256
257        Returns
258        -------
259        dict:
260            Information on each selected run (key = run_name, value = dict of
261            run information fields.), one at a time.
262        """
263
264        raise NotImplementedError
265
266    def runs_dir(self, campaign_name=None):
267        """
268        Get the directory used to store run information for `campaign_name`.
269
270        Parameters
271        ----------
272        campaign_name: str
273            Name of the selected campaign.
274
275        Returns
276        -------
277        str:
278            Path containing run outputs.
279        """
280
281        raise NotImplementedError
282
283    def get_num_runs(self, campaign=None, sampler=None, status=None, not_status=None):
284        """
285        Returns the number of runs matching the filtering criteria.
286
287        Parameters
288        ----------
289        campaign: int or None
290            Campaign id to filter for.
291        sampler: int or None
292            Sampler id to filter for.
293        status: enum(Status) or None
294            Status string to filter for.
295        not_status: enum(Status) or None
296            Exclude runs with this status string
297
298        Returns
299        -------
300        int:
301            The number of runs in the database matching the filtering criteria
302
303        """
304
305        raise NotImplementedError
306
307    def get_campaign_id(self, name):
308        """
309        Return the (database) id corresponding to the campaign with name 'name'.
310
311        Parameters
312        ----------
313        name: str
314            Name of the campaign.
315
316        Returns
317        -------
318        int:
319            The id of the campaign with the specified name
320        """
321
322        raise NotImplementedError
323
324    def get_run_status(self, run_name, campaign=None, sampler=None):
325        """
326        Return the status (enum) for the run with name 'run_name' (and, optionally,
327        filtering for campaign and sampler by id)
328
329        Parameters
330        ----------
331        run_name: str
332            Name of the run
333        campaign: int
334            ID of the desired Campaign
335        sampler: int
336            ID of the desired Sampler
337
338        Returns
339        -------
340        status: enum(Status)
341            Status of the run.
342        """
343
344        raise NotImplementedError
345
346    def set_run_statuses(self, run_name_list, status):
347        """
348        Set the specified 'status' (enum) for all runs in the list run_ID_list
349
350        Parameters
351        ----------
352        run_name_list: list of str
353            A list of run names run names (format is usually: prefix + int)
354        status: enum(Status)
355            The new status all listed runs should now have
356
357        Returns
358        -------
359
360        """
361
362        raise NotImplementedError
363
364    def append_collation_dataframe(self, df, app_id):
365        """
366        Append the data in dataframe 'df' to that already collated in the database
367
368        Parameters
369        ----------
370        df: pandas dataframe
371            The dataframe whose contents need to be appended to the collation store
372        app_id: int
373            The id of this app in the sql database. Used to determine which collation
374            table is appended to.
375
376        Returns
377        -------
378        """
379
380        raise NotImplementedError
381
382    def get_collation_dataframe(self, app_id):
383        """
384        Returns a dataframe containing the full collated results stored in this database
385        i.e. the total of what was added with the append_collation_dataframe() method.
386
387        Parameters
388        ----------
389        app_id: int
390            The id of this app in the sql database. Used to determine which collation
391            table is returned.
392
393        Returns
394        -------
395        df: pandas dataframe
396            The dataframe with all contents that were appended to the table corresponding
397            to this app_id.
398        """
399
400        raise NotImplementedError
class BaseCampaignDB:
 29class BaseCampaignDB:
 30    """Baseclass for all EasyVVUQ CampaignDBs
 31
 32    Skeleton for class that provides database access for the campaign.
 33
 34    Parameters
 35    ----------
 36    location: str or None
 37        Location to look for database.
 38    new_campaign: bool
 39        Does the database need to be initialised as a new campaign.
 40    name: str or None
 41        Name of the campaign.
 42    info: `easyvvuq.data_structs.CampaignInfo`
 43        Information defining the campaign.
 44    """
 45
 46    def __init__(self, location=None, new_campaign=False, name=None, info=None):
 47        pass
 48
 49    def app(self, name):
 50        """
 51        Get app information. Specific applications selected by `name`,
 52        otherwise first entry in database 'app' selected.
 53
 54        Parameters
 55        ----------
 56        name : str or None
 57            Name of selected app, if `None` given then first app will be
 58            selected.
 59
 60        Returns
 61        -------
 62        dict:
 63            Application information.
 64        """
 65
 66        raise NotImplementedError
 67
 68    def add_app(self, app_info):
 69        """
 70        Add application to the 'app' table.
 71
 72        Parameters
 73        ----------
 74        app_info: AppInfo
 75            Application definition.
 76
 77        Returns
 78        -------
 79
 80        """
 81
 82        raise NotImplementedError
 83
 84    def add_sampler(self, sampler):
 85        """
 86        Add new Sampler to the 'sampler' table.
 87
 88        Parameters
 89        ----------
 90        sampler: BaseSamplingElement
 91
 92        Returns
 93        -------
 94
 95        """
 96
 97        raise NotImplementedError
 98
 99    def update_sampler(self, sampler_id, sampler_element):
100        """
101        Update the state of the Sampler with id 'sampler_id' to
102        that in the passed 'sampler_element'
103
104        Parameters
105        ----------
106        sampler_id: int
107            The id of the sampler in the db to update
108        sampler_element: BaseSamplingElement
109            The sampler whose state should be used as the new state
110
111        Returns
112        -------
113
114        """
115
116        raise NotImplementedError
117
118    def resurrect_sampler(self, sampler_id):
119        """
120        Return the sampler object corresponding to id sampler_id in the database.
121        It is deserialized from the state stored in the database.
122
123        Parameters
124        ----------
125        sampler_id: int
126            The id of the sampler to resurrect
127
128        Returns
129        -------
130        BaseSamplingElement
131            The 'live' sampler object, deserialized from the state in the db
132
133        """
134
135        raise NotImplementedError
136
137    def resurrect_app(self, app_name):
138        """
139        Return the 'live' encoder and decoder objects corresponding to the app with
140        name 'app_name' in the database. They are deserialized from the states
141        previously stored in the database.
142
143        Parameters
144        ----------
145        app_name: string
146            Name of the app to resurrect
147
148        Returns
149        -------
150        BaseEncoder, BaseDecoder, BaseCollationElement
151            The 'live' encoder and decoder objects associated with this app
152
153        """
154
155        raise NotImplementedError
156
157    def add_run(self, run_info=None, prefix='Run_'):
158        """
159        Add run to the `runs` table in the database.
160
161        Parameters
162        ----------
163        run_info: `easyvvuq.data_structs.RunInfo`
164            Contains relevant run fields: params, status (where in the
165            EasyVVUQ workflow is this RunTable), campaign (id number),
166            sample, app
167        prefix: str
168            Prefix for run id
169
170        Returns
171        -------
172
173        """
174
175        raise NotImplementedError
176
177    def set_dir_for_run(self, run_name, run_dir, campaign=None, sampler=None):
178        """
179        Set the 'run_dir' path for the specified run in the database.
180
181        Parameters
182        ----------
183        run_name: str
184            Name of run to filter for.
185        run_dir: str
186            Directory path associated to set for this run.
187        campaign:  int or None
188            Campaign id to filter for.
189        sampler: int or None
190            Sample id to filter for.
191
192        Returns
193        -------
194
195        """
196
197        raise NotImplementedError
198
199    def run(self, run_name, campaign=None, sampler=None):
200        """
201        Get the information for a specified run.
202
203        Parameters
204        ----------
205        run_name: str
206            Name of run to filter for.
207        campaign:  int or None
208            Campaign id to filter for.
209        sampler: int or None
210            Sample id to filter for.
211
212        Returns
213        -------
214        dict
215            Containing run information (run_name, params, status, sample,
216            campaign, app)
217        """
218        raise NotImplementedError
219
220    def campaigns(self):
221        """Get list of campaigns for which information is stored in the
222        database.
223
224        Returns
225        -------
226        list:
227            Campaign names.
228        """
229
230        raise NotImplementedError
231
232    def campaign_dir(self, campaign_name=None):
233        """Get campaign directory for `campaign_name`.
234
235        Returns
236        -------
237        str:
238            Path to campaign directory.
239        """
240
241        raise NotImplementedError
242
243    def runs(self, campaign=None, sampler=None, status=None, not_status=None):
244        """
245        A generator to return all run information for selected `campaign` and `sampler`.
246
247        Parameters
248        ----------
249        campaign: int or None
250            Campaign id to filter for.
251        sampler: int or None
252            Sampler id to filter for.
253        status: enum(Status) or None
254            Status string to filter for.
255        not_status: enum(Status) or None
256            Exclude runs with this status string
257
258        Returns
259        -------
260        dict:
261            Information on each selected run (key = run_name, value = dict of
262            run information fields.), one at a time.
263        """
264
265        raise NotImplementedError
266
267    def runs_dir(self, campaign_name=None):
268        """
269        Get the directory used to store run information for `campaign_name`.
270
271        Parameters
272        ----------
273        campaign_name: str
274            Name of the selected campaign.
275
276        Returns
277        -------
278        str:
279            Path containing run outputs.
280        """
281
282        raise NotImplementedError
283
284    def get_num_runs(self, campaign=None, sampler=None, status=None, not_status=None):
285        """
286        Returns the number of runs matching the filtering criteria.
287
288        Parameters
289        ----------
290        campaign: int or None
291            Campaign id to filter for.
292        sampler: int or None
293            Sampler id to filter for.
294        status: enum(Status) or None
295            Status string to filter for.
296        not_status: enum(Status) or None
297            Exclude runs with this status string
298
299        Returns
300        -------
301        int:
302            The number of runs in the database matching the filtering criteria
303
304        """
305
306        raise NotImplementedError
307
308    def get_campaign_id(self, name):
309        """
310        Return the (database) id corresponding to the campaign with name 'name'.
311
312        Parameters
313        ----------
314        name: str
315            Name of the campaign.
316
317        Returns
318        -------
319        int:
320            The id of the campaign with the specified name
321        """
322
323        raise NotImplementedError
324
325    def get_run_status(self, run_name, campaign=None, sampler=None):
326        """
327        Return the status (enum) for the run with name 'run_name' (and, optionally,
328        filtering for campaign and sampler by id)
329
330        Parameters
331        ----------
332        run_name: str
333            Name of the run
334        campaign: int
335            ID of the desired Campaign
336        sampler: int
337            ID of the desired Sampler
338
339        Returns
340        -------
341        status: enum(Status)
342            Status of the run.
343        """
344
345        raise NotImplementedError
346
347    def set_run_statuses(self, run_name_list, status):
348        """
349        Set the specified 'status' (enum) for all runs in the list run_ID_list
350
351        Parameters
352        ----------
353        run_name_list: list of str
354            A list of run names run names (format is usually: prefix + int)
355        status: enum(Status)
356            The new status all listed runs should now have
357
358        Returns
359        -------
360
361        """
362
363        raise NotImplementedError
364
365    def append_collation_dataframe(self, df, app_id):
366        """
367        Append the data in dataframe 'df' to that already collated in the database
368
369        Parameters
370        ----------
371        df: pandas dataframe
372            The dataframe whose contents need to be appended to the collation store
373        app_id: int
374            The id of this app in the sql database. Used to determine which collation
375            table is appended to.
376
377        Returns
378        -------
379        """
380
381        raise NotImplementedError
382
383    def get_collation_dataframe(self, app_id):
384        """
385        Returns a dataframe containing the full collated results stored in this database
386        i.e. the total of what was added with the append_collation_dataframe() method.
387
388        Parameters
389        ----------
390        app_id: int
391            The id of this app in the sql database. Used to determine which collation
392            table is returned.
393
394        Returns
395        -------
396        df: pandas dataframe
397            The dataframe with all contents that were appended to the table corresponding
398            to this app_id.
399        """
400
401        raise NotImplementedError

Baseclass for all EasyVVUQ CampaignDBs

Skeleton for class that provides database access for the campaign.

Parameters
  • location (str or None): Location to look for database.
  • new_campaign (bool): Does the database need to be initialised as a new campaign.
  • name (str or None): Name of the campaign.
  • info (easyvvuq.data_structs.CampaignInfo): Information defining the campaign.
BaseCampaignDB(location=None, new_campaign=False, name=None, info=None)
46    def __init__(self, location=None, new_campaign=False, name=None, info=None):
47        pass
def app(self, name):
49    def app(self, name):
50        """
51        Get app information. Specific applications selected by `name`,
52        otherwise first entry in database 'app' selected.
53
54        Parameters
55        ----------
56        name : str or None
57            Name of selected app, if `None` given then first app will be
58            selected.
59
60        Returns
61        -------
62        dict:
63            Application information.
64        """
65
66        raise NotImplementedError

Get app information. Specific applications selected by name, otherwise first entry in database 'app' selected.

Parameters
  • name (str or None): Name of selected app, if None given then first app will be selected.
Returns
  • dict:: Application information.
def add_app(self, app_info):
68    def add_app(self, app_info):
69        """
70        Add application to the 'app' table.
71
72        Parameters
73        ----------
74        app_info: AppInfo
75            Application definition.
76
77        Returns
78        -------
79
80        """
81
82        raise NotImplementedError

Add application to the 'app' table.

Parameters
  • app_info (AppInfo): Application definition.
  • Returns
  • -------
def add_sampler(self, sampler):
84    def add_sampler(self, sampler):
85        """
86        Add new Sampler to the 'sampler' table.
87
88        Parameters
89        ----------
90        sampler: BaseSamplingElement
91
92        Returns
93        -------
94
95        """
96
97        raise NotImplementedError

Add new Sampler to the 'sampler' table.

Parameters
  • sampler (BaseSamplingElement):

  • Returns

  • -------
def update_sampler(self, sampler_id, sampler_element):
 99    def update_sampler(self, sampler_id, sampler_element):
100        """
101        Update the state of the Sampler with id 'sampler_id' to
102        that in the passed 'sampler_element'
103
104        Parameters
105        ----------
106        sampler_id: int
107            The id of the sampler in the db to update
108        sampler_element: BaseSamplingElement
109            The sampler whose state should be used as the new state
110
111        Returns
112        -------
113
114        """
115
116        raise NotImplementedError

Update the state of the Sampler with id 'sampler_id' to that in the passed 'sampler_element'

Parameters
  • sampler_id (int): The id of the sampler in the db to update
  • sampler_element (BaseSamplingElement): The sampler whose state should be used as the new state
  • Returns
  • -------
def resurrect_sampler(self, sampler_id):
118    def resurrect_sampler(self, sampler_id):
119        """
120        Return the sampler object corresponding to id sampler_id in the database.
121        It is deserialized from the state stored in the database.
122
123        Parameters
124        ----------
125        sampler_id: int
126            The id of the sampler to resurrect
127
128        Returns
129        -------
130        BaseSamplingElement
131            The 'live' sampler object, deserialized from the state in the db
132
133        """
134
135        raise NotImplementedError

Return the sampler object corresponding to id sampler_id in the database. It is deserialized from the state stored in the database.

Parameters
  • sampler_id (int): The id of the sampler to resurrect
Returns
  • BaseSamplingElement: The 'live' sampler object, deserialized from the state in the db
def resurrect_app(self, app_name):
137    def resurrect_app(self, app_name):
138        """
139        Return the 'live' encoder and decoder objects corresponding to the app with
140        name 'app_name' in the database. They are deserialized from the states
141        previously stored in the database.
142
143        Parameters
144        ----------
145        app_name: string
146            Name of the app to resurrect
147
148        Returns
149        -------
150        BaseEncoder, BaseDecoder, BaseCollationElement
151            The 'live' encoder and decoder objects associated with this app
152
153        """
154
155        raise NotImplementedError

Return the 'live' encoder and decoder objects corresponding to the app with name 'app_name' in the database. They are deserialized from the states previously stored in the database.

Parameters
  • app_name (string): Name of the app to resurrect
Returns
  • BaseEncoder, BaseDecoder, BaseCollationElement: The 'live' encoder and decoder objects associated with this app
def add_run(self, run_info=None, prefix='Run_'):
157    def add_run(self, run_info=None, prefix='Run_'):
158        """
159        Add run to the `runs` table in the database.
160
161        Parameters
162        ----------
163        run_info: `easyvvuq.data_structs.RunInfo`
164            Contains relevant run fields: params, status (where in the
165            EasyVVUQ workflow is this RunTable), campaign (id number),
166            sample, app
167        prefix: str
168            Prefix for run id
169
170        Returns
171        -------
172
173        """
174
175        raise NotImplementedError

Add run to the runs table in the database.

Parameters
  • run_info (easyvvuq.data_structs.RunInfo): Contains relevant run fields: params, status (where in the EasyVVUQ workflow is this RunTable), campaign (id number), sample, app
  • prefix (str): Prefix for run id
  • Returns
  • -------
def set_dir_for_run(self, run_name, run_dir, campaign=None, sampler=None):
177    def set_dir_for_run(self, run_name, run_dir, campaign=None, sampler=None):
178        """
179        Set the 'run_dir' path for the specified run in the database.
180
181        Parameters
182        ----------
183        run_name: str
184            Name of run to filter for.
185        run_dir: str
186            Directory path associated to set for this run.
187        campaign:  int or None
188            Campaign id to filter for.
189        sampler: int or None
190            Sample id to filter for.
191
192        Returns
193        -------
194
195        """
196
197        raise NotImplementedError

Set the 'run_dir' path for the specified run in the database.

Parameters
  • run_name (str): Name of run to filter for.
  • run_dir (str): Directory path associated to set for this run.
  • campaign (int or None): Campaign id to filter for.
  • sampler (int or None): Sample id to filter for.
  • Returns
  • -------
def run(self, run_name, campaign=None, sampler=None):
199    def run(self, run_name, campaign=None, sampler=None):
200        """
201        Get the information for a specified run.
202
203        Parameters
204        ----------
205        run_name: str
206            Name of run to filter for.
207        campaign:  int or None
208            Campaign id to filter for.
209        sampler: int or None
210            Sample id to filter for.
211
212        Returns
213        -------
214        dict
215            Containing run information (run_name, params, status, sample,
216            campaign, app)
217        """
218        raise NotImplementedError

Get the information for a specified run.

Parameters
  • run_name (str): Name of run to filter for.
  • campaign (int or None): Campaign id to filter for.
  • sampler (int or None): Sample id to filter for.
Returns
  • dict: Containing run information (run_name, params, status, sample, campaign, app)
def campaigns(self):
220    def campaigns(self):
221        """Get list of campaigns for which information is stored in the
222        database.
223
224        Returns
225        -------
226        list:
227            Campaign names.
228        """
229
230        raise NotImplementedError

Get list of campaigns for which information is stored in the database.

Returns
  • list:: Campaign names.
def campaign_dir(self, campaign_name=None):
232    def campaign_dir(self, campaign_name=None):
233        """Get campaign directory for `campaign_name`.
234
235        Returns
236        -------
237        str:
238            Path to campaign directory.
239        """
240
241        raise NotImplementedError

Get campaign directory for campaign_name.

Returns
  • str:: Path to campaign directory.
def runs(self, campaign=None, sampler=None, status=None, not_status=None):
243    def runs(self, campaign=None, sampler=None, status=None, not_status=None):
244        """
245        A generator to return all run information for selected `campaign` and `sampler`.
246
247        Parameters
248        ----------
249        campaign: int or None
250            Campaign id to filter for.
251        sampler: int or None
252            Sampler id to filter for.
253        status: enum(Status) or None
254            Status string to filter for.
255        not_status: enum(Status) or None
256            Exclude runs with this status string
257
258        Returns
259        -------
260        dict:
261            Information on each selected run (key = run_name, value = dict of
262            run information fields.), one at a time.
263        """
264
265        raise NotImplementedError

A generator to return all run information for selected campaign and sampler.

Parameters
  • campaign (int or None): Campaign id to filter for.
  • sampler (int or None): Sampler id to filter for.
  • status (enum(Status) or None): Status string to filter for.
  • not_status (enum(Status) or None): Exclude runs with this status string
Returns
  • dict:: Information on each selected run (key = run_name, value = dict of run information fields.), one at a time.
def runs_dir(self, campaign_name=None):
267    def runs_dir(self, campaign_name=None):
268        """
269        Get the directory used to store run information for `campaign_name`.
270
271        Parameters
272        ----------
273        campaign_name: str
274            Name of the selected campaign.
275
276        Returns
277        -------
278        str:
279            Path containing run outputs.
280        """
281
282        raise NotImplementedError

Get the directory used to store run information for campaign_name.

Parameters
  • campaign_name (str): Name of the selected campaign.
Returns
  • str:: Path containing run outputs.
def get_num_runs(self, campaign=None, sampler=None, status=None, not_status=None):
284    def get_num_runs(self, campaign=None, sampler=None, status=None, not_status=None):
285        """
286        Returns the number of runs matching the filtering criteria.
287
288        Parameters
289        ----------
290        campaign: int or None
291            Campaign id to filter for.
292        sampler: int or None
293            Sampler id to filter for.
294        status: enum(Status) or None
295            Status string to filter for.
296        not_status: enum(Status) or None
297            Exclude runs with this status string
298
299        Returns
300        -------
301        int:
302            The number of runs in the database matching the filtering criteria
303
304        """
305
306        raise NotImplementedError

Returns the number of runs matching the filtering criteria.

Parameters
  • campaign (int or None): Campaign id to filter for.
  • sampler (int or None): Sampler id to filter for.
  • status (enum(Status) or None): Status string to filter for.
  • not_status (enum(Status) or None): Exclude runs with this status string
Returns
  • int:: The number of runs in the database matching the filtering criteria
def get_campaign_id(self, name):
308    def get_campaign_id(self, name):
309        """
310        Return the (database) id corresponding to the campaign with name 'name'.
311
312        Parameters
313        ----------
314        name: str
315            Name of the campaign.
316
317        Returns
318        -------
319        int:
320            The id of the campaign with the specified name
321        """
322
323        raise NotImplementedError

Return the (database) id corresponding to the campaign with name 'name'.

Parameters
  • name (str): Name of the campaign.
Returns
  • int:: The id of the campaign with the specified name
def get_run_status(self, run_name, campaign=None, sampler=None):
325    def get_run_status(self, run_name, campaign=None, sampler=None):
326        """
327        Return the status (enum) for the run with name 'run_name' (and, optionally,
328        filtering for campaign and sampler by id)
329
330        Parameters
331        ----------
332        run_name: str
333            Name of the run
334        campaign: int
335            ID of the desired Campaign
336        sampler: int
337            ID of the desired Sampler
338
339        Returns
340        -------
341        status: enum(Status)
342            Status of the run.
343        """
344
345        raise NotImplementedError

Return the status (enum) for the run with name 'run_name' (and, optionally, filtering for campaign and sampler by id)

Parameters
  • run_name (str): Name of the run
  • campaign (int): ID of the desired Campaign
  • sampler (int): ID of the desired Sampler
Returns
  • status (enum(Status)): Status of the run.
def set_run_statuses(self, run_name_list, status):
347    def set_run_statuses(self, run_name_list, status):
348        """
349        Set the specified 'status' (enum) for all runs in the list run_ID_list
350
351        Parameters
352        ----------
353        run_name_list: list of str
354            A list of run names run names (format is usually: prefix + int)
355        status: enum(Status)
356            The new status all listed runs should now have
357
358        Returns
359        -------
360
361        """
362
363        raise NotImplementedError

Set the specified 'status' (enum) for all runs in the list run_ID_list

Parameters
  • run_name_list (list of str): A list of run names run names (format is usually: prefix + int)
  • status (enum(Status)): The new status all listed runs should now have
  • Returns
  • -------
def append_collation_dataframe(self, df, app_id):
365    def append_collation_dataframe(self, df, app_id):
366        """
367        Append the data in dataframe 'df' to that already collated in the database
368
369        Parameters
370        ----------
371        df: pandas dataframe
372            The dataframe whose contents need to be appended to the collation store
373        app_id: int
374            The id of this app in the sql database. Used to determine which collation
375            table is appended to.
376
377        Returns
378        -------
379        """
380
381        raise NotImplementedError

Append the data in dataframe 'df' to that already collated in the database

Parameters
  • df (pandas dataframe): The dataframe whose contents need to be appended to the collation store
  • app_id (int): The id of this app in the sql database. Used to determine which collation table is appended to.
  • Returns
  • -------
def get_collation_dataframe(self, app_id):
383    def get_collation_dataframe(self, app_id):
384        """
385        Returns a dataframe containing the full collated results stored in this database
386        i.e. the total of what was added with the append_collation_dataframe() method.
387
388        Parameters
389        ----------
390        app_id: int
391            The id of this app in the sql database. Used to determine which collation
392            table is returned.
393
394        Returns
395        -------
396        df: pandas dataframe
397            The dataframe with all contents that were appended to the table corresponding
398            to this app_id.
399        """
400
401        raise NotImplementedError

Returns a dataframe containing the full collated results stored in this database i.e. the total of what was added with the append_collation_dataframe() method.

Parameters
  • app_id (int): The id of this app in the sql database. Used to determine which collation table is returned.
Returns
  • df (pandas dataframe): The dataframe with all contents that were appended to the table corresponding to this app_id.