Skip to main content

perfectoAI is an automated emailable reporter along with AI graphs & predictions

Project description

Perfectoai

Recommended system configuration:

1. 8 GB Ram and above

2. 2.20 GHz multi core processors and above

Prerequisites:

  1. Install Python version 3+ and make sure that python version > 3+ is set as default.

  2. Install pip

  3. Run the following command from command prompt:

    pip install perfectoai -U

terminal:

    `pip3 install perfectoai -U`

Additional requirements for Report processing:  

* Install [npm](https://nodejs.org/en/)

* Run the following command from command prompt/ terminal:

        Mac: 
            `sudo npm install -g electron@1.8.4 orca --unsafe-perm=true`
        Windows: 
            `npm install -g electron@1.8.4 orca --unsafe-perm=true`

Usage:

Examples:

Device Operations:

  1. List all available devices:

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>"

  2. List all available devices with an optional feature to provide custom logo ( Syntax: -l "www.):

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -l "www.perfecto.io"

  3. List all available devices using perfecto username and password:

    perfectoai -c "<<CLOUD NAME>>" -s "<<username/email>>:<<password>>"

  4. List all devices irrespective on device status:

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -t all

  5. Reboot, clean up and get network settings for all devices in parallel:

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -t "all" -a "reboot:true;cleanup:true;get_network_settings:true"

  6. Limit the selection of devices by applying any/multiple Get Devices List parameters and regular expressions using the following syntax: {param1}:{value1};{param2}:{value2}

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -d "model:Galaxy S.*;description:.*Genesis;dynamicField.ipa:Test-Android.*"

  7. get network settings like airplane mode, wifi and data for only available galaxy devices in parallel:

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -a "get_network_settings:true" -d "model:Galaxy.*"

Repository clean-up:

  1. Syntax to automatically display older repository items: -a "clean_repo|false|{do you have admin role? - true|false }|media repository locations|number of days to select items older than the provided date". The following example will automatically display repository media items older than 15 days

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -a "clean_repo|false|true|PUBLIC:Genesis/Temp/,PRIVATE:Python,GROUP:Genesis|15"

  2. Syntax to automatically delete older repository items: -a "clean_repo|true|{do you have admin role? - true|false} |media repository locations|number of days to select items older than the provided date". The following example will automatically delete and display repository media items older than 15 days

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -a "clean_repo|true|true|PUBLIC:Genesis/Temp/,PRIVATE:Python,GROUP:Genesis|15"

Limit User list:

  1. Syntax to limit/filter users list: -u "{param1}:{value1};{param2}:{value2}"

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -u "roles:AUTOMATION;firstName:Genesis"

General:

  1. Re-runs the same execution with a specified sleep time:

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -r 1

  2. Skip's output in html format: ( for faster results in terminal/cmd )

    perfectoai -c "<<CLOUD NAME>>" -s "<<SECURITY TOKEN>>" -o false

Notes:
Reach out to Perfecto support if you want to enable non-admin users the ability to delete media repository files for users who have access to the same group folder. We recommend that you assign a unique description or dynamicField for devices that are applicable for reboot and utilize the -d parameter for reboot. See the Limit the selection of the devices example.
perfectoai is subject to the same restrictions and limitations as the Reboot device API, with regard to locked phones and limitations to reboot devices by certain manufacturers. For details, see Devices Restart Limitation. However, the latest perfecto actions version will automatically skips manufacturers which are listed as limitations for reboot.

Note:

1. Make sure active scripting is enabled in IE browser.
2. Preferred browsers are Chrome and Safari.
3. Kindly use python version 3 and above.

Experimental proxy: ( Yet to be tested )

Configure proxies by setting environment variables HTTP_PROXY and HTTPS_PROXY. E.g. in mac:

    export HTTP_PROXY="10.10.1.10:3128"
    export HTTPS_PROXY="10.10.1.10:1080"

To use HTTPS Basic Auth with your proxy, try this: https://user:password@host:port

    export HTTP_PROXY="https://user:pass@10.10.1.10:3128/"
    export HTTPS_PROXY="https://user:pass@10.10.1.10:3128/"

Note: avoid using special characters such as :,@ in username and passwords

Scheduling in Windows:

1. Open Task Scheduler.
2. Create a new task.
3. Name it as preferred.
4. Click on trigger and then click on New.
5. Set the trigger as preferred. E.g. Select daily to run daily.
6. Click on Actions and then click on New.
7. Browse the actions.bat file, a sample .bat file is found here: https://github.com/PerfectoMobileSA/Device_actions_reporter/blob/master/samples/actions.bat.
8. Make sure to edit the actions.bat file and supply your preferred arguments to perfectoai [ line:2 ].
9. perfectoai will be triggered based on the trigger.
10. Results will be displayed as like the image below if -o is not set to false in perfectoai arguments.

Scheduling in Mac:

1. Type "which perfectoai" in terminal to get the physical path of perfectoai.
2. Download a sample shell file from  here: https://github.com/PerfectoMobileSA/Device_actions_reporter/blob/master/samples/actions.sh.
3. Edit the downloaded .sh file.
4. Set the physical path of perfectoai and applicable arguments.
5. Open terminal and navigate to the location where the actions.sh was downloaded and run the following command:
    chmod +x ./actions.sh 
6. You need to grant cron full disk access. Drag /usr/sbin/cron into the Full Disk Access area in System Preferences > Security & Privacy > Privacy tab.
7. Run the terminal command : "crontab -e”
8. Press i.
9. Enter the following in the below syntax:

        {cron} /{path of actions.sh}/actions.sh >/{path of logs}/stdout.log 2>/{path of error logs}/stderr.log

    E.g.:
        30 2 * * * /Users/genesisthomas/Downloads/actions.sh  >/tmp/stdout.log 2>/tmp/stderr.log

10. Note: 30 2 * * * runs the cron job at 2:30 am everyday.
11. Press ":wq!” to save the file and click on OK in the trailing popup.
12. Run the command "crontab -l" to see whether the cron job is activated/ enabled.
13. Verify the results.

Scheduling from Jenkins:

1. Login into Jenkins
2. Go to Manage Jenkins -> Manage Plugins and install HTML Publisher plugin.
3. Go back to Manage Jenkins page and then navigate to Script Console page.
4. Paste the below in console and click on Run. 
    System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
5. Clear browser history and cache, restart browser and login into Jenkins.
6. Create a new free style job in Jenkins.
7. Enable Build periodically under Build triggers section.
8. Enter your preferred cron schedule under schedule section.
    E.g. "30 2 * * *" will run the job at 2:30 am everyday
9. Enable "Delete workspace before build starts" under Build Environment section.
10. WINDOWS:
    Add a build step: Execute Windows batch command and add the below commands inside it:

        pip install -U perfectoai
        del /s /q "C:\Users\<<Windows user name>>\AppData\Local\Temp\output\*.*"
        perfectoai -c <<CLOUD NAME, e.g. demo>>  -s "<<SECURITY TOKEN>>" <<ADDITIONAL ARGUMENTS AS APPLICABLE>>
        xcopy /s "C:\Users\<<Windows user name>>\AppData\Local\Temp\output" .
        EXIT /B
    MAC:
    Add a build step: Execute shell and add the below commands inside it:
        <<PATH TO PIP>>/pip3 install -U perfectoai
        rm -rf "/tmp/output/*.*"
        perfectoai -c <<CLOUD NAME, e.g. demo>> -s "<<SECURITY TOKEN>>" <<ADDITIONAL ARGUMENTS AS APPLICABLE>>
        cp /tmp/output/result.html .
Note: 
   1. Update preferred values within <<>> as applicable
   2. Use which command in terminal to find path of pip3/perfectoai. E.g. "which pip3" will show the path of pip3.

11. Add post-build Actions: Archive the artifacts with files to archive: result.html (Screenshots above)
12. Add post-build Actions: Publish HTML reports with index page: result.html (Screenshots above)
13. Run the job to find the results.html being published as a html report.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

perfectoai-1.0.21.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

perfectoai-1.0.21-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

Details for the file perfectoai-1.0.21.tar.gz.

File metadata

  • Download URL: perfectoai-1.0.21.tar.gz
  • Upload date:
  • Size: 57.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for perfectoai-1.0.21.tar.gz
Algorithm Hash digest
SHA256 ab2b939ad13f429ef4ce11311ff3bccb3ebdc7933c70a7ffb48a4bdf94eef154
MD5 6b62fb1333e6c43d80559442d37a3cda
BLAKE2b-256 d7094b63b200e56698ebf5821275536adc4098836ede5c49e6e8d04c08478045

See more details on using hashes here.

File details

Details for the file perfectoai-1.0.21-py3-none-any.whl.

File metadata

  • Download URL: perfectoai-1.0.21-py3-none-any.whl
  • Upload date:
  • Size: 53.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for perfectoai-1.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 314c8f706de67634e1db8d23ca1e615ad0ff9979b515fe12e0ce0e7e5be318c0
MD5 d250b476e9d62fb21c8e33dd6e5b8124
BLAKE2b-256 5d69ff48fcb53482422824a378a56215dfa10c8b713bca1b35bb8ba292af3639

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page