latest conversion changes 02052024

This commit is contained in:
Ubuntu 2024-05-02 07:48:38 +00:00
parent 62bf265236
commit 31ef7d4e27
3 changed files with 12 additions and 5 deletions

View File

@ -57,6 +57,7 @@ def run_conversion(msg):
background_thread = threading.Thread(target=background_execution, args=(obj,)) background_thread = threading.Thread(target=background_execution, args=(obj,))
background_thread.start() background_thread.start()
background_thread.join() background_thread.join()
s3_client.delete_object(Bucket='conversion-kitchen', Key=object_key)
msg.delete() msg.delete()

View File

@ -510,14 +510,12 @@ class Conversion:
try: try:
response = s3_client.upload_file(filee, bucket, object_name) response = s3_client.upload_file(filee, bucket, object_name)
s3_url = f"https://{bucket}.s3.ap-south-1.amazonaws.com/{object_name}" s3_url = f"https://{bucket}.s3.ap-south-1.amazonaws.com/{object_name}"
self.translated_script_object.translated_script_pdf = s3_url
print(response) print(response)
except Exception as e: except Exception as e:
print("Error is", e) print("Error is", e)
else: else:
"""Blockchain Upload Starts here""" """Blockchain Upload Starts here"""
@ -553,7 +551,10 @@ class Conversion:
userkey = decryptionOfPrivate(userPrivateKey) userkey = decryptionOfPrivate(userPrivateKey)
tx_id, tx_gas_fee = UploadConversionData(OWNER_KEY, blockchain_obj.publicKey, UserId, str(Project), tx_id, tx_gas_fee = UploadConversionData(OWNER_KEY, blockchain_obj.publicKey, UserId, str(Project),
Data) Data)
print("Tx id -> ", tx_id,tx_gas_fee) print("Tx id -> ", tx_id,tx_gas_fee)
print(type(tx_id))
# user_infos = user_info(tx_hash=tx_id, service="Conversion", gas_fee=2345432345123456) # user_infos = user_info(tx_hash=tx_id, service="Conversion", gas_fee=2345432345123456)
# addition_result = user_infos.update_info(request) # addition_result = user_infos.update_info(request)
try: try:
@ -586,6 +587,10 @@ class Conversion:
"""Process Completed""" """Process Completed"""
self.translated_script_object.status = "Completed" self.translated_script_object.status = "Completed"
try:
self.translated_script_object.blockchain_txhash = tx_id
except:
self.translated_script_object.translated_script_pdf = s3_url
self.translated_script_object.save() self.translated_script_object.save()
return self.response return self.response

View File

@ -290,6 +290,7 @@ class ScriptTranslations(models.Model):
left_dual_dial_script = models.CharField(max_length=220, null=True, blank=True) left_dual_dial_script = models.CharField(max_length=220, null=True, blank=True)
free_output = models.BooleanField(default=False) free_output = models.BooleanField(default=False)
status = models.CharField(max_length=220, null=True, blank=True) status = models.CharField(max_length=220, null=True, blank=True)
blockchain_txhash = models.CharField(max_length=220, null=True, blank=True)
error_desc = models.CharField(max_length=2000, null=True, blank=True) error_desc = models.CharField(max_length=2000, null=True, blank=True)