Commit 7a3724d6 authored by mail-related applications's avatar mail-related applications
Browse files

added a new line character to the file opens in sift drive and added an error...

added a new line character to the file opens in sift drive and added an error report upload in transfer drive
parent 3530253b
This diff is collapsed.
......@@ -196,7 +196,7 @@ class Sifter:
def write_logfiles(self):
if len(self.transfer_files) > 0:
target = '{}/transfer_files.csv'.format(self.log_path)
with open(target, 'w+') as csvfile:
with open(target, 'w+', newline='') as csvfile:
fieldnames = ['owner', 'name', 'id', 'link', 'parent', 'created'] # NOQA 501
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
......@@ -206,7 +206,7 @@ class Sifter:
if len(self.private_files) > 0:
target = '{}/private_files.csv'.format(self.log_path)
with open(target, 'w+') as csvfile:
with open(target, 'w+', newline='') as csvfile:
fieldnames = ['owner', 'name', 'id', 'link', 'parent', 'created'] # NOQA 501
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
......@@ -216,7 +216,7 @@ class Sifter:
if len(self.unknown_files) > 0:
target = '{}/unknown_files.csv'.format(self.log_path)
with open(target, 'w+') as csvfile:
with open(target, 'w+', newline='') as csvfile:
fieldnames = ['owner', 'name', 'id', 'link', 'parent', 'created'] # NOQA 501
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
......
......@@ -9,8 +9,11 @@ import yaml
from cak_core import arg_prompt
from subprocess import check_output as cmd
from subprocess import CalledProcessError
from datetime import datetime
devnull = open(os.devnull, 'w+')
file_errors = [{"id": "eraeraeraer", "payload": "adsrasr"}]
class Mover:
......@@ -90,19 +93,24 @@ class Mover:
),
extra={'entity': item['owner']}
)
transfer_error = True
pass
#continue on error
if transfer_error == True:
self.logger.info('{} can not be transferred moving on to next file'.format(item['id']), extra={'entity': item['owner']})
file_errors.append({'id': item['id'],'payload': item})
else:
self.logger.info(
'{} transferred successfully'.format(item['id']),
extra={'entity': item['owner']}
)
if hasattr(self, 'strip_access'):
if self.strip_access:
self.strip_permissions(item)
self.upload_file_errors(item['owner'])
def strip_permissions(self, item):
try:
cmd([
......@@ -117,7 +125,48 @@ class Mover:
except CalledProcessError as e:
self.logger.warning(e.output, extra={'entity': item['owner']})
def upload_file_errors(self, owner):
timestamp = datetime.now()
timestamp = timestamp.strftime("%m-%d-%Y %H:%M")
target = ""
if len(file_errors) > 0:
target = '{}/{}_Drive_Transfer_file_errors {}.csv'.format(os.getcwd(),owner,timestamp)
print ("Creating Target CSV")
with open(target, 'w+') as csvfile:
fieldnames = ['id', 'payload'] # NOQA 501
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for item in file_errors:
writer.writerow(item)
csvfile.close()
print ("Uploading Errors Sheet to Google")
#timestamp = datetime.now()
#timestamp = timestamp.strftime("%m/%d/%Y %H:%M")
#file_error_filename = "/{} file errors {}.csv".format(owner, timestamp)
#open ('test.csv', 'x')
#with open('test.csv', 'w', encoding='utf8', newline='') as output_file:
# fc = csv.DictWriter(output_file, fieldnames=keys,)
# fc.writeheader()
# fc.writerows(file_errors)
a = cmd([
self.config['google']['gam_command'],
'user',
'rsauosci@collab.its.umich.edu',
'add',
'drivefile',
'localfile',
target
])
print (a.decode('utf-8', 'ignore'))
def main():
helptext = '''examples:
......@@ -208,6 +257,6 @@ def main():
mover = Mover(vars(args), config)
mover.transfer_files()
if __name__ == '__main__':
main()
owner,name,id,link,parent,created
rsauosci@collab.its.umich.edu,Attack the block_20190416T104413.644778.sesx,15rkwPEdMrrBJN7e8fXkEOVgVCwtJ-TBJ,https://drive.google.com/file/d/15rkwPEdMrrBJN7e8fXkEOVgVCwtJ-TBJ/view?usp=drivesdk,,2022-01-28T15:56:40.205Z
rsauosci@collab.its.umich.edu,Untitled Session 1_20190408T212258.069296.sesx,1_WAIsuMoleWb4fyiCYHp4eIfDNhD1KnT,https://drive.google.com/file/d/1_WAIsuMoleWb4fyiCYHp4eIfDNhD1KnT/view?usp=drivesdk,,2022-01-28T16:02:03.815Z
rsauosci@collab.its.umich.edu,Untitled Session 1_20190408T212155.725949.sesx,1hioiRHQtHB3F_tiKMbkXOn4X1mLt2ECF,https://drive.google.com/file/d/1hioiRHQtHB3F_tiKMbkXOn4X1mLt2ECF/view?usp=drivesdk,,2022-01-28T16:06:32.806Z
rsauosci@collab.its.umich.edu,Attack the block_20190408T212005.254790.sesx,1T9vpmyyBK4u8tG92r_6RMAXZyUDtu3Ur,https://drive.google.com/file/d/1T9vpmyyBK4u8tG92r_6RMAXZyUDtu3Ur/view?usp=drivesdk,,2022-01-28T15:56:39.518Z
rsauosci@collab.its.umich.edu,trailer.pkf,1sdzWk-FSks1wipX5cy5CK6WlbENWaMQI,https://drive.google.com/file/d/1sdzWk-FSks1wipX5cy5CK6WlbENWaMQI/view?usp=drivesdk,,2022-01-28T15:56:54.540Z
rsauosci@collab.its.umich.edu,untitled.pkf,1HEd0sicBytNttJZfRfr4yJM6oxe80Ni2,https://drive.google.com/file/d/1HEd0sicBytNttJZfRfr4yJM6oxe80Ni2/view?usp=drivesdk,,2022-01-28T15:57:07.965Z
rsauosci@collab.its.umich.edu,Untitled Session 1.sesx,13w0jx6mulTzUSaLDPcA3k5-YLOXyk2b9,https://drive.google.com/file/d/13w0jx6mulTzUSaLDPcA3k5-YLOXyk2b9/view?usp=drivesdk,,2022-01-28T15:52:44.645Z
rsauosci@collab.its.umich.edu,beep.pkf,1CJsfg34lLZqVlXsb6wUy_O6jZsFiyApm,https://drive.google.com/file/d/1CJsfg34lLZqVlXsb6wUy_O6jZsFiyApm/view?usp=drivesdk,,2022-01-28T16:03:16.415Z
rsauosci@collab.its.umich.edu,leto.pkf,15SIKIAGILyYlVzX2J98-4Rd-HDLX-C_7,https://drive.google.com/file/d/15SIKIAGILyYlVzX2J98-4Rd-HDLX-C_7/view?usp=drivesdk,,2022-01-28T16:04:49.355Z
rsauosci@collab.its.umich.edu,eqtest_20190116T163138.499190.sesx,17Vvng5hMRMr8dRxmFhv8cA2_NoaPPja0,https://drive.google.com/file/d/17Vvng5hMRMr8dRxmFhv8cA2_NoaPPja0/view?usp=drivesdk,,2022-01-28T15:57:34.648Z
rsauosci@collab.its.umich.edu,wadpodtest_20190116T162858.211875.sesx,1i8GmobywcjwzsgReUXjnp0460g6NVZTz,https://drive.google.com/file/d/1i8GmobywcjwzsgReUXjnp0460g6NVZTz/view?usp=drivesdk,,2022-01-28T15:59:55.030Z
rsauosci@collab.its.umich.edu,eqtest_20190116T162838.479665.sesx,1g1fd4Fb2J3YSg8X-R4LFrMgvgVksHuKr,https://drive.google.com/file/d/1g1fd4Fb2J3YSg8X-R4LFrMgvgVksHuKr/view?usp=drivesdk,,2022-01-28T15:57:34.031Z
rsauosci@collab.its.umich.edu,wadpodtest_20190116T162558.194486.sesx,1WqGCZ69tf8pqjP5Oq0hH3TPUFMUiFdzh,https://drive.google.com/file/d/1WqGCZ69tf8pqjP5Oq0hH3TPUFMUiFdzh/view?usp=drivesdk,,2022-01-28T15:58:39.607Z
rsauosci@collab.its.umich.edu,Untitled Session 1_20190116T162342.337660.sesx,1Q0uoynbgZZuBMEtuQpk5qVMKwcGjMMfY,https://drive.google.com/file/d/1Q0uoynbgZZuBMEtuQpk5qVMKwcGjMMfY/view?usp=drivesdk,,2022-01-28T15:58:07.305Z
rsauosci@collab.its.umich.edu,news 44100 1.pkf,1T3x56OJWc3R15majlMwLsV4jWAk6UDHy,https://drive.google.com/file/d/1T3x56OJWc3R15majlMwLsV4jWAk6UDHy/view?usp=drivesdk,,2022-01-28T16:02:46.725Z
rsauosci@collab.its.umich.edu,beep 48000 1.pkf,1bN4smq_7uc3nzpSQI1XgrFCArQuAXF6f,https://drive.google.com/file/d/1bN4smq_7uc3nzpSQI1XgrFCArQuAXF6f/view?usp=drivesdk,,2022-01-28T15:59:00.738Z
rsauosci@collab.its.umich.edu,intro 48000 1.pkf,1DR2eVSYgbL8qddLi0wKBpp5W06PEo0KX,https://drive.google.com/file/d/1DR2eVSYgbL8qddLi0wKBpp5W06PEo0KX/view?usp=drivesdk,,2022-01-28T16:01:38.872Z
rsauosci@collab.its.umich.edu,boyegainterview.pkf,1I4J2BtFPWN3g_toQ_8w_GEyngJGFFF97,https://drive.google.com/file/d/1I4J2BtFPWN3g_toQ_8w_GEyngJGFFF97/view?usp=drivesdk,,2022-01-28T16:01:39.347Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T180234.321169.sesx,1xOMEYpwaZ9kXX8r5Mn7s5i-5PY-3QqWK,https://drive.google.com/file/d/1xOMEYpwaZ9kXX8r5Mn7s5i-5PY-3QqWK/view?usp=drivesdk,,2022-01-28T15:56:38.443Z
rsauosci@collab.its.umich.edu,outro 48000 1.pkf,1F05RVhhWmgw4zH8CptgO6X-q_sCnUz2Y,https://drive.google.com/file/d/1F05RVhhWmgw4zH8CptgO6X-q_sCnUz2Y/view?usp=drivesdk,,2022-01-28T16:01:39.260Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T175517.775877.sesx,10tNUFhRZbdDraWQgr02A9wG6bOMJ3Bhs,https://drive.google.com/file/d/10tNUFhRZbdDraWQgr02A9wG6bOMJ3Bhs/view?usp=drivesdk,,2022-01-28T15:56:46.947Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T175103.299203.sesx,1IrqeebjK1XSq66QW6WcYCVc60V7GYZGW,https://drive.google.com/file/d/1IrqeebjK1XSq66QW6WcYCVc60V7GYZGW/view?usp=drivesdk,,2022-01-28T15:56:42.792Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T174725.153774.sesx,1nQhn4c1Ubzp9RhDE16skLcMi1BEzx3RU,https://drive.google.com/file/d/1nQhn4c1Ubzp9RhDE16skLcMi1BEzx3RU/view?usp=drivesdk,,2022-01-28T15:53:24.431Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T174342.751322.sesx,1aHrU_ag-WiZF3h5FhX0WNkGZNWe2g3du,https://drive.google.com/file/d/1aHrU_ag-WiZF3h5FhX0WNkGZNWe2g3du/view?usp=drivesdk,,2022-01-28T15:54:23.137Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T174042.563769.sesx,1X5HjOOpv08RYzgN4AxhBaJyTeQiyLV7S,https://drive.google.com/file/d/1X5HjOOpv08RYzgN4AxhBaJyTeQiyLV7S/view?usp=drivesdk,,2022-01-28T15:56:37.326Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T173740.382536.sesx,1dTG7nAtWB9qcM99fKufIqnSPce-ZWrzM,https://drive.google.com/file/d/1dTG7nAtWB9qcM99fKufIqnSPce-ZWrzM/view?usp=drivesdk,,2022-01-28T15:56:30.007Z
rsauosci@collab.its.umich.edu,Attack the block_20190114T173417.884993.sesx,1hlhdh-8je01F1f0MPF-dcuaxB4n52YMI,https://drive.google.com/file/d/1hlhdh-8je01F1f0MPF-dcuaxB4n52YMI/view?usp=drivesdk,,2022-01-28T15:55:16.732Z
rsauosci@collab.its.umich.edu,hihatgetsit 48000 1.pkf,1KwmuRfJZSlQxIyYtD8wJzDoHRvqiRox3,https://drive.google.com/file/d/1KwmuRfJZSlQxIyYtD8wJzDoHRvqiRox3/view?usp=drivesdk,,2022-01-28T16:01:38.872Z
rsauosci@collab.its.umich.edu,cornish 48000 1.pkf,1ule2jVxxyZulFISSOVX4-igUjKaD1wBO,https://drive.google.com/file/d/1ule2jVxxyZulFISSOVX4-igUjKaD1wBO/view?usp=drivesdk,,2022-01-28T16:00:21.406Z
rsauosci@collab.its.umich.edu,blatblatblat 48000 1.pkf,1iGnmx7rw7OwaOA-IZ50An_LG2x8U2dYp,https://drive.google.com/file/d/1iGnmx7rw7OwaOA-IZ50An_LG2x8U2dYp/view?usp=drivesdk,,2022-01-28T16:00:32.237Z
rsauosci@collab.its.umich.edu,Blast-attacktheblock.sesx,10pZ7uE81kCTMTf_RUlIvY9YbI9ffT1Gg,https://drive.google.com/file/d/10pZ7uE81kCTMTf_RUlIvY9YbI9ffT1Gg/view?usp=drivesdk,,2022-01-28T16:04:07.398Z
rsauosci@collab.its.umich.edu,death 48000 1.wav,1JByf2J16cPUO_x_IyZfOP7S0c5-GXa0G,https://drive.google.com/file/d/1JByf2J16cPUO_x_IyZfOP7S0c5-GXa0G/view?usp=drivesdk,,2022-01-28T16:01:37.124Z
rsauosci@collab.its.umich.edu,weedroom 48000 1.pkf,1GIxcRDDQf5FTsCuzUfME_peR79_jvZFL,https://drive.google.com/file/d/1GIxcRDDQf5FTsCuzUfME_peR79_jvZFL/view?usp=drivesdk,,2022-01-28T16:01:39.347Z
rsauosci@collab.its.umich.edu,mugging 48000 1.pkf,1KS_kon6Sr0kMp5vK_SovYBoLqHKgxhkq,https://drive.google.com/file/d/1KS_kon6Sr0kMp5vK_SovYBoLqHKgxhkq/view?usp=drivesdk,,2022-01-28T16:01:37.765Z
rsauosci@collab.its.umich.edu,trailer 48000 1.pkf,1e-dQjOMMqqd7hVXoH5Q4Y2gwm8BEC99Y,https://drive.google.com/file/d/1e-dQjOMMqqd7hVXoH5Q4Y2gwm8BEC99Y/view?usp=drivesdk,,2022-01-28T16:01:38.307Z
rsauosci@collab.its.umich.edu,slam 48000 1.pkf,1PB_c7rxl6oJAXnPomlOLVzjZsA6eZszq,https://drive.google.com/file/d/1PB_c7rxl6oJAXnPomlOLVzjZsA6eZszq/view?usp=drivesdk,,2022-01-28T16:01:36.375Z
rsauosci@collab.its.umich.edu,ronsweedroom 48000 1.pkf,1vSfHH321V5idXONGoDCilmoI7Gf2AWtT,https://drive.google.com/file/d/1vSfHH321V5idXONGoDCilmoI7Gf2AWtT/view?usp=drivesdk,,2022-01-28T16:01:37.285Z
rsauosci@collab.its.umich.edu,wadblast 48000 1_merged.pkf,1NUHI7yRBzHWd1iH2EGCvQrNY8QRHTpG-,https://drive.google.com/file/d/1NUHI7yRBzHWd1iH2EGCvQrNY8QRHTpG-/view?usp=drivesdk,,2022-01-28T15:52:45.481Z
rsauosci@collab.its.umich.edu,test_20181121T161704.268319.sesx,1tuJYm190_e1HRUiMT56gEW52S2mvVfCF,https://drive.google.com/file/d/1tuJYm190_e1HRUiMT56gEW52S2mvVfCF/view?usp=drivesdk,,2022-01-28T16:05:05.437Z
rsauosci@collab.its.umich.edu,Untitled Session 2.sesx,1oqw7DZhxt-UvEmiDJKpYxjIZ37qbFaxI,https://drive.google.com/file/d/1oqw7DZhxt-UvEmiDJKpYxjIZ37qbFaxI/view?usp=drivesdk,,2022-01-28T16:06:31.880Z
rsauosci@collab.its.umich.edu,bloops_R.pkf,1EgLoaArGCLj0KVba8iuT6lzHOlxYNPyp,https://drive.google.com/file/d/1EgLoaArGCLj0KVba8iuT6lzHOlxYNPyp/view?usp=drivesdk,,2022-01-28T15:57:02.121Z
rsauosci@collab.its.umich.edu,bloops_L.pkf,1kzoiSu5_9CXQ1LPVhA8fbNPzHYBgg59Z,https://drive.google.com/file/d/1kzoiSu5_9CXQ1LPVhA8fbNPzHYBgg59Z/view?usp=drivesdk,,2022-01-28T15:57:08.598Z
rsauosci@collab.its.umich.edu,Untitled Session 1.sesx,1bzs4DiDenbvIwHoqUnz8aoHSXAodB0s6,https://drive.google.com/file/d/1bzs4DiDenbvIwHoqUnz8aoHSXAodB0s6/view?usp=drivesdk,,2022-01-28T15:56:56.804Z
rsauosci@collab.its.umich.edu,Track 1_002 44100 1_L.pkf,1YitYwwR69M442vyAJT1bLA7utBsY_2nT,https://drive.google.com/file/d/1YitYwwR69M442vyAJT1bLA7utBsY_2nT/view?usp=drivesdk,,2022-01-28T15:57:16.124Z
rsauosci@collab.its.umich.edu,Track 1_002 44100 1_R.pkf,1B3VvnZwhIjBZZu-5NEXV9QaN71081RDM,https://drive.google.com/file/d/1B3VvnZwhIjBZZu-5NEXV9QaN71081RDM/view?usp=drivesdk,,2022-01-28T15:57:26.106Z
rsauosci@collab.its.umich.edu,WADPod Template.sesx,1ZOeyuU7ghxUUoPphbZcsF5IKOvcMNToO,https://drive.google.com/file/d/1ZOeyuU7ghxUUoPphbZcsF5IKOvcMNToO/view?usp=drivesdk,,2022-01-28T15:57:26.894Z
jckroll@umich.edu,1-6_teleprompter.pptx,1WvOU6F3g_2f19nsIXAIHDl6s3ZW5xfe5,https://docs.google.com/presentation/d/1WvOU6F3g_2f19nsIXAIHDl6s3ZW5xfe5/edit?usp=drivesdk&ouid=100445444766761565757&rtpof=true&sd=true,root,2022-01-21T09:09:42.273Z
rsauosci@collab.its.umich.edu, na,174GH-x6nW5Js9exsSR-lrJYAstTqYG603l5EB4Two0c,fdsafasf,dsafsafas,sadf
rsauosci@collab.its.umich.edu, na,1-D2K8lp6rTcAlCjt18BuogAymWDvX8RG0cQozRDsS_I,fdasree,dasiig,eaead
id,payload
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment