### winter 2020 zaps
                           #"-zap_chans", str(165), str(340),
                           #"-zap_chans", str(345), str(355),
                           #"-zap_chans", str(380), str(390),
                           #"-zap_chans", str(400), str(410),
                           #"-zap_chans", str(435), str(455),
                           "-detect_thresh", str(opts.thresh), "-output_dir", outdir])
    #subprocess.check_call(['chown','-R','50000:50000',str(outdir)]) # old pulsar account
    # need to chown and chmod to pulsar group
    subprocess.check_call(['chown','-R','4875:6850',str(outdir)]) 
    subprocess.check_call(['chmod','-R','g=u',str(outdir)])

if __name__ == "__main__":
    from optparse import OptionParser
    parser = OptionParser()
    PP.add_pika_process_opts(parser)
    parser.add_option("-d","--lowdm",dest='lodm',default=0.0)
    parser.add_option("-D","--highdm",dest='hidm',default=2000.0)
    parser.add_option("-T","--thresh",dest='thresh',default=8.0)
    (opts,args) = parser.parse_args()
    processor = PP.pika_process_from_opts(opts)
    processor.process(lambda message: on_message(message, opts))

''' optparse!!!

rabbitMQ/pikaURL pw username host port (and default) DONE
queue names DONE
heimdall xtra args: DONE
atexit, at fail put file back to input queue
fix gpu=0 !!!
kubectl get all
Example #2
0
def merge_two_dicts(x, y):
    z = x.copy()   # start with x's keys and values
    z.update(y)    # modifies z with y's keys and values & returns None
    return z




    
   
if __name__=='__main__':
   
    # Update all input arguments
    parser = optparse.OptionParser()
    pika_process.add_pika_process_opts(parser)
    parser.add_option('--pl',type=str,help='pipeline details file',dest="pipe")
    parser.add_option('--xml',type=str,help='xml file to test',dest="xml")
    parser.add_option('--out',type=str,help='output directory name',dest="outp",default="/beegfs/PROCESSING/TRAPUM/peasoup32_products")
    parser.add_option('--segment_lengths',type=str,help='segment lengths to search over full file',dest="segs",default="10,20")
    parser.add_option('--dm_segments',type=int,help='number of dm segments (RAM limited)',dest="dm_segs",default=2)
    parser.add_option('--companion_mass',type=float,help='Companion mass in solar masses',dest="mc",default=4.0)
    opts,args = parser.parse_args()

    # Setup logging config
    log_type = opts.log_level
    log.setLevel(log_type.upper())


    # Test no cands
    test_no_cands(opts)
                                  cwd=info["output_path"])

    #except subprocess.CalledProcessError:
    #    log.info("Partial file exists. Removing and creating a new one....")
    #    subprocess.check_call("rm %s/%s"%(info['output_path'],info['filename']),shell=True)
    #    print ("rm %s/%s"%(info['output_path'],info['filename']))
    #    subprocess.check_call(digifil_script,shell=True)
    # Publish to Rabbit
    #pika_process.publish_info(opts,info)

    except Exception as e:
        log.error("Merge and failed for %s in path %s" %
                  (prepfold_script, info['output_path']))
        log.error(e)


if __name__ == "__main__":

    # Update all input arguments
    consume_parser = optparse.OptionParser()
    pika_process.add_pika_process_opts(consume_parser)
    opts, args = consume_parser.parse_args()

    # Setup logging config
    log_type = opts.log_level
    log.setLevel(log_type.upper())

    #Consume message from RabbitMQ
    processor = pika_process.pika_process_from_opts(opts)
    processor.process(lambda message: receive_and_merge(message, opts))