aboutsummaryrefslogtreecommitdiffstats
path: root/python/process_queue.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/process_queue.py')
-rw-r--r--python/process_queue.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/python/process_queue.py b/python/process_queue.py
index fab0fc78..ea0fe6e9 100644
--- a/python/process_queue.py
+++ b/python/process_queue.py
@@ -339,16 +339,13 @@ def process_list(
if trade_type == "bond" and fund == "SERCGMAST":
trades = [send_email(trade) for trade in trades]
if fund in ("SERCGMAST", "BOWDST") or trade_type in ("cds", "swaption"):
- try:
- buf = generate_csv(
- (t for t in trades if t.get("upload", True)), trade_type, fund,
- )
- dest = get_filepath(DAILY_DIR, trade_type, fund)
- if upload:
- upload_buf(buf, dest.name, fund)
- dest.write_bytes(buf)
- except IOError:
- pass
+ buf = generate_csv(
+ (t for t in trades if t.get("upload", True)), trade_type, fund,
+ )
+ dest = get_filepath(DAILY_DIR, trade_type, fund)
+ if upload:
+ upload_buf(buf, dest.name, fund)
+ dest.write_bytes(buf)
p.delete(key)
@@ -857,8 +854,7 @@ def upload_buf(buf: bytes, dest: str, fund: str) -> None:
elif fund == "BOWDST":
sftp = SftpClient.from_creds("bony")
sftp.client.chdir("/inbound/cfe/")
- sftp.put(buf, dest)
- attach = FileAttachment(dest, buf)
+ sftp.put(buf, dest, False)
em = ExchangeMessage()
em.send_email(
"Trade file",
@@ -868,7 +864,7 @@ def upload_buf(buf: bytes, dest: str, fund: str) -> None:
"hm-operations@bnymellon.com",
),
cc_recipients=("bowdoin-ops@lmcg.com",),
- attachments=(FileAttachment(dest, buf),),
+ attach=(FileAttachment(name=dest, content=buf),),
)
else:
raise ValueError("unknow fund name")