Beispiel #1
0
                    help = "Autodetect available workers and add them to the instance")
  parser.add_option("--add-example-work-sources", action = "store_true", default = False,
                    help = "Add the example work sources to the instance")
  (options, args) = parser.parse_args()
  
  # Figure out instance name
  if len(args) == 0: instancename = "default"
  elif len(args) == 1: instancename = args[0]
  else: parser.error("Incorrect number of arguments")

  # Create core instance, will load saved instance state if present
  core = Core(instance = instancename, default_loglevel = options.default_loglevel)
  
  # Autodetect appropriate frontends if requested or if a new instance is being set up
  if options.detect_frontends or core.is_new_instance:
    core.detect_frontends()
  
  # Autodetect available workers if requested or if a new instance is being set up
  if options.detect_workers or core.is_new_instance:
    core.detect_workers()

  # Add example work sources if requested or if a new instance is being set up
  if options.add_example_work_sources or core.is_new_instance:
    from core.blockchain import Blockchain
    from core.worksourcegroup import WorkSourceGroup
    from modules.theseven.bcjsonrpc.bcjsonrpcworksource import BCJSONRPCWorkSource
    # Find the Bitcoin block chain, or create it if neccessary
    blockchain = core.get_blockchain_by_name("Bitcoin")
    if not blockchain:
      blockchain = Blockchain(core)
      blockchain.settings.name = "Bitcoin"
                    help = "Autodetect available workers and add them to the instance")
  parser.add_option("--add-example-work-sources", action = "store_true", default = False,
                    help = "Add the example work sources to the instance")
  (options, args) = parser.parse_args()

  # Figure out instance name
  if len(args) == 0: instancename = "default"
  elif len(args) == 1: instancename = args[0]
  else: parser.error("Incorrect number of arguments")

  # Create core instance, will load saved instance state if present
  core = Core(instance = instancename, default_loglevel = options.default_loglevel)

  # Autodetect appropriate frontends if requested or if a new instance is being set up
  if options.detect_frontends or core.is_new_instance:
    core.detect_frontends()

  # Autodetect available workers if requested or if a new instance is being set up
  if options.detect_workers or core.is_new_instance:
    core.detect_workers()

  # Add example work sources if requested or if a new instance is being set up
  if options.add_example_work_sources or core.is_new_instance:
    from core.blockchain import Blockchain
    from core.worksourcegroup import WorkSourceGroup
    from modules.theseven.bcjsonrpc.bcjsonrpcworksource import BCJSONRPCWorkSource
    # Find the Bitcoin block chain, or create it if neccessary
    blockchain = core.get_blockchain_by_name("Bitcoin")
    if not blockchain:
      blockchain = Blockchain(core)
      blockchain.settings.name = "Bitcoin"