Skip to Main Content
Integration


This is an IBM Automation portal for Integration products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.


Status Functionality already exists
Workspace Aspera Ideas
Created by Guest
Created on Dec 12, 2023

Faspex: Delete Package Older Than x Days

As available on Faspex v4 , we can configure a feature which delete the packages older than x days.


It is not present on Faspex v5

Idea priority High
  • Admin
    Freya Jennison
    Reply
    |
    Jan 4, 2024

    Hi! We will be reaching out via support ticket TS014951799

  • Guest
    Reply
    |
    Dec 30, 2023

    I used a python script, connected to the faspex db, on e_packages tables.


    As below =


    Python script - With MySQL Connection



    from glob import glob

    from datetime import datetime, timedelta

    from os import stat, path as os_path

    from shutil import rmtree

    from sys import path as sys_path

    sys_path.insert(0, "./.")

    import SQL

    class RM:

    def __init__(self, rqst=None, data=None):

    self.connec = SQL.BDD()._connec()

    self.rqst = rqst

    self.data = data

    self.doc_root = '/home/faspex/QNAP/ASPERA'

    def __select_mysql(self):

    sql = self.connec

    cur = sql.cursor()

    if self.data is None:

    cur.execute(self.rqst)

    else:

    cur.execute(self.rqst % self.data)

    fields = [field_md[0] for field_md in cur.description]

    result = [dict(zip(fields, row)) for row in cur.fetchall()]

    return result

    def __write_log(self, level, msg):

    with open('./remove.log', 'a') as file:

    file.write(f"{[datetime.strftime(datetime.now(), '%Y-%m-%d %H:%M:%S')]} {level} {msg}\n")

    return True

    def remove_package_bis(self):

    out_json = {}

    rqst = "SELECT * FROM e_packages;"

    select_older_package = RM(rqst=rqst).__select_mysql()

    for x in select_older_package:

    if x["updated_at"] < datetime.now() - timedelta(days=2) and x['e_package_upload_status'] != 'running':

    out_json['updated_at'] = x["updated_at"]

    out_json['outer_directory_name'] = x['outer_directory_name']

    out_json['e_package_upload_status'] = x['e_package_upload_status']

    try:

    rmtree(path=f"'{os_path.join(self.doc_root, x['outer_directory_name'])}'")

    RM().__write_log(level='INFO', msg=out_json)

    except:

    # print(f"'{os_path.join(self.doc_root, x['outer_directory_name'])}'")

    pass

    return True


    if __name__ == "__main__":

    RM().remove_package_bis()