Results 1 to 3 of 3

Hybrid View

  1. #1

    Default Submitting entire catalogs to ACP Scheduler

    I wanted to experiment with submitting an entire catalog (exported from vizier and filtered for appropriate FOV based on my rig specifications).

    Doing this by hand could be a chore.

    Since I already had a script (see my other post) to submit an entire target with pre-burnt parameters, I wanted to create a way to batch submit an entire catalog (via a csv).

    So there's this python script I wrote:

    Code:
    import requests
    import csv
    import sys
    from distutils.util import strtobool
    
    
    if len(sys.argv) < 6:
        print("Please pass the catalog csv file as an argument plus ACP IP and Port and username and passwd")
        exit(-1)
    
    
    url = 'http://' + sys.argv[2] + ':' + sys.argv[3] + '/ac/asentiretarget.asp'
    print (" Reading Targets from " + sys.argv[1] + "...")
    
    
    filters = ["Lum", "Red", "Green", "Blue", "Ha", "SII", "OIII"]
    subs = {'Lum' : 180.0, 'Red' : 600.0, 'Blue' : 600.0, 'Green' : 600.0, 'Ha' : 1200.0, 'SII' : 1200.0, 'OIII' : 1200.0}
    total = {'Lum' : 6.0, 'Red' : 3.0, 'Blue' : 3.0, 'Green' : 3.0, 'Ha' : 15.0, 'SII' : 15.0, 'OIII' : 15.0}
    
    
    with open(sys.argv[1], newline='') as catalogs:
        reader = csv.DictReader(catalogs)
        for target in reader:
            target["visOnly"] = "false"
            target["isOrb"] = "dsky"
            for filter in filters:
                if strtobool(target[filter]):
                    target[filter] = "yes"
                    target[filter + "Hrs"] = total[filter]
                    target[filter + "Subs"] = subs[filter]
                else:
                    target.pop(filter)
            print("Submitting Target ")
            print(target)
            resp = requests.post(url, data = target, auth = (sys.argv[4], sys.argv[5]))
            print("Response from Namid ACP: ")
            print(resp)
            print("\n\n")
    Since we are batch submitting and could end up with a whole bunch of unwated targets if we are not careful. I then also wrote a way to batch delete them:

    Code:
    import requests
    import csv
    import sys
    from distutils.util import strtobool
    
    
    if len(sys.argv) < 7:
        print("Please pass the beginning and ending ids (inclusive) plus ACP IP and Port and username and passwd")
        exit(-1)
    
    
    url = 'http://' + sys.argv[3] + ':' + sys.argv[4] + '/sc/seditproj.asp'
    
    
    for id in range(int(sys.argv[1]),int(sys.argv[2]) + 1):
        params= {};
        params["op"] = "delete"
        params["id"] = id
        print('Deleting Target {0}'.format(id))
        resp = requests.post(url, data = params, auth = (sys.argv[5], sys.argv[6]))
        print("Response from Namid ACP: ")
        print(resp)
        print("\n\n")
    With batch delete, you need the project ids. You can get this from exploring the scheduler mdb file from Microsoft Access or other programs which will let you introspect it. Another way you can do it is to open the scheduler browser in the web and opening a project along with the browser inspection tool and see what the payload of the request to delete it. This will give you the project id. If you used the batch submit these ids will be contiguous.

    I admit these are dirty hacks. But they work for me and could for you.

    Ideally, schedule browser desktop program would offer a way to batch modify targets, but this does not exist as a feature. <hint> <hint> Bob Denny

  2. #2
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    33,887

    Default

    WOW!!! This is a cool hack. Not at all dirty, I made ACP have a published submission API! ACP Expert 9 is days away from final release and was feature frizen a couple of months ago. But this isn't wat I would call a 'common' task anyway and is thus perfectly suited for scripting. Bravo!

    I hope I see you at AIC in May.
    -- Bob

  3. #3

    Default

    thanks Bob

    Yes! I will see you at AIC.

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Submitting an entire target with preset options
    By Manoj Koushik in forum Add-Ons, Enhancements, and Helper Components
    Replies: 3
    Last Post: Jan 31, 2022, 16:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •