mirror of
				https://github.com/bspeice/metrik
				synced 2025-11-04 02:10:43 -05:00 
			
		
		
		
	Add a 'now' tag to the database records
This commit is contained in:
		
							
								
								
									
										8
									
								
								.idea/inspectionProfiles/Project_Default.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								.idea/inspectionProfiles/Project_Default.xml
									
									
									
										generated
									
									
									
								
							@ -24,5 +24,13 @@
 | 
				
			|||||||
        </value>
 | 
					        </value>
 | 
				
			||||||
      </option>
 | 
					      </option>
 | 
				
			||||||
    </inspection_tool>
 | 
					    </inspection_tool>
 | 
				
			||||||
 | 
					    <inspection_tool class="PyUnresolvedReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false">
 | 
				
			||||||
 | 
					      <option name="ignoredIdentifiers">
 | 
				
			||||||
 | 
					        <list>
 | 
				
			||||||
 | 
					          <option value="quote_plus" />
 | 
				
			||||||
 | 
					          <option value="six.moves.urllib.parse" />
 | 
				
			||||||
 | 
					        </list>
 | 
				
			||||||
 | 
					      </option>
 | 
				
			||||||
 | 
					    </inspection_tool>
 | 
				
			||||||
  </profile>
 | 
					  </profile>
 | 
				
			||||||
</component>
 | 
					</component>
 | 
				
			||||||
							
								
								
									
										6
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							@ -38,6 +38,12 @@
 | 
				
			|||||||
      <property name="caretWidth" class="java.lang.Integer" />
 | 
					      <property name="caretWidth" class="java.lang.Integer" />
 | 
				
			||||||
    </properties>
 | 
					    </properties>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="EntryPointsManager">
 | 
				
			||||||
 | 
					    <entry_points version="2.0" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="FrameworkDetectionExcludesConfiguration">
 | 
				
			||||||
 | 
					    <type id="django" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
 | 
					  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
 | 
				
			||||||
    <OptionsSetting value="true" id="Add" />
 | 
					    <OptionsSetting value="true" id="Add" />
 | 
				
			||||||
    <OptionsSetting value="true" id="Remove" />
 | 
					    <OptionsSetting value="true" id="Remove" />
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
from luigi import Target
 | 
					from luigi import Target
 | 
				
			||||||
from pymongo import MongoClient
 | 
					from pymongo import MongoClient
 | 
				
			||||||
from metrik.conf import MONGO_HOST, MONGO_PORT, MONGO_DATABASE
 | 
					from metrik.conf import MONGO_HOST, MONGO_PORT, MONGO_DATABASE
 | 
				
			||||||
 | 
					from datetime import datetime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MongoTarget(Target):
 | 
					class MongoTarget(Target):
 | 
				
			||||||
@ -18,6 +19,7 @@ class MongoTarget(Target):
 | 
				
			|||||||
    def persist(self, dict_object):
 | 
					    def persist(self, dict_object):
 | 
				
			||||||
        id_dict = dict_object
 | 
					        id_dict = dict_object
 | 
				
			||||||
        id_dict['_id'] = self.id
 | 
					        id_dict['_id'] = self.id
 | 
				
			||||||
 | 
					        id_dict['_retrieved'] = datetime.now()
 | 
				
			||||||
        return self.collection.insert_one(id_dict).inserted_id
 | 
					        return self.collection.insert_one(id_dict).inserted_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def retrieve(self):
 | 
					    def retrieve(self):
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,12 @@
 | 
				
			|||||||
from __future__ import print_function
 | 
					from __future__ import print_function
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import csv
 | 
					import csv
 | 
				
			||||||
import pytz
 | 
					 | 
				
			||||||
import requests
 | 
					import requests
 | 
				
			||||||
from collections import namedtuple
 | 
					from collections import namedtuple
 | 
				
			||||||
from dateutil.parser import parse
 | 
					from dateutil.parser import parse
 | 
				
			||||||
from io import StringIO
 | 
					from io import StringIO
 | 
				
			||||||
import logging
 | 
					
 | 
				
			||||||
from luigi.parameter import DateParameter, Parameter
 | 
					from luigi.parameter import DateParameter, Parameter
 | 
				
			||||||
# noinspection PyUnresolvedReferences
 | 
					 | 
				
			||||||
from six.moves.urllib.parse import quote_plus
 | 
					from six.moves.urllib.parse import quote_plus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from metrik.tasks.base import MongoCreateTask
 | 
					from metrik.tasks.base import MongoCreateTask
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user