opensampl.mixins.collect
Tools for adding data collection functionality to probes
CollectMixin
Bases: ABC
Mixin to add data collection capabilities to a probe class
Source code in opensampl/mixins/collect.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
CollectArtifact
Bases: BaseModel
Model for a single probe's collected data
Source code in opensampl/mixins/collect.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
single_reference
property
All individual data artifacts use the same reference
single_reference_type
property
All individual data artifacts use the same reference type
CollectConfig
Bases: BaseModel
Configuration for collecting data
Attributes:
| Name | Type | Description |
|---|---|---|
output_dir |
Path | None
|
When provided, will save collected data as a file to provided directory. Filename will be automatically generated as {vendor}{ip_address}{probe_id}{vendor}{timestamp}.txt |
load |
bool
|
Whether to load collected data directly to the database |
duration |
int
|
Number of seconds to collect data for |
Source code in opensampl/mixins/collect.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
DataArtifact
Bases: BaseModel
Model for a single metric type of collected data
Source code in opensampl/mixins/collect.py
25 26 27 28 29 30 31 32 | |
collect(collect_config)
abstractmethod
classmethod
Collect data and output CollectArtifact using collect_config
Source code in opensampl/mixins/collect.py
158 159 160 161 162 | |
collect_help_str()
classmethod
Help string for use in the collect CLI.
Source code in opensampl/mixins/collect.py
75 76 77 78 79 80 81 | |
create_file_content(collect_artifact)
abstractmethod
classmethod
Given a CollectArtifact, create the str content for a file
Source code in opensampl/mixins/collect.py
164 165 166 167 168 | |
filter_files(files)
classmethod
Filter the files found in the input directory when loading this vendor's data files
Source code in opensampl/mixins/collect.py
144 145 146 147 | |
get_collect_cli_command()
classmethod
Create a click command that handles data collection
Returns
A click CLI command that collects probe data
Source code in opensampl/mixins/collect.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
get_collect_cli_options()
classmethod
Return the click options/arguments for collecting probe data.
Source code in opensampl/mixins/collect.py
83 84 85 86 87 88 89 | |
load_metadata(probe_key, metadata)
classmethod
Load provided metadata associated with given probe_key
Distinct from BaseProbe.parse_metadata because it is a class method without access to self.input_file
Source code in opensampl/mixins/collect.py
149 150 151 152 153 154 155 156 | |