示例#1
0
def superadmin_client():
    from singa_auto.client import Client
    admin_host = os.environ['ADMIN_HOST']
    admin_port = os.environ['ADMIN_PORT']
    client = Client(admin_host=admin_host, admin_port=admin_port)
    client.login(email=SUPERADMIN_EMAIL,
                 password=os.environ['SUPERADMIN_PASSWORD'])
    return client
示例#2
0
                        type=int,
                        default=0,
                        help='How many GPUs to use for training')
    parser.add_argument(
        '--hours',
        type=float,
        default=0.1,
        help='How long the train job should run for (in hours)')  # 6min
    parser.add_argument(
        '--query_path',
        type=str,
        default=
        'examples/data/image_classification/fashion_mnist_test_1.png,examples/data/image_classification/fashion_mnist_test_2.png',
        help='Path(s) to query image(s), delimited by commas')
    (args, _) = parser.parse_known_args()
    out_train_dataset_path = 'data/fashion_mnist_train.zip'
    out_val_dataset_path = 'data/fashion_mnist_val.zip'

    # Initialize client
    client = Client()
    client.login(email=args.email, password=args.password)
    web_admin_url = 'http://{}:{}'.format(args.host, args.web_admin_port)
    print('During training, you can view the status of the train job at {}'.
          format(web_admin_url))
    print('Login with email "{}" and password "{}"'.format(
        args.email, args.password))

    # Run quickstart
    quickstart(client, out_train_dataset_path, out_val_dataset_path, args.gpus,
               args.hours, args.query_path.split(','))
示例#3
0
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

import os

from singa_auto.client import Client
from singa_auto.config import SUPERADMIN_EMAIL

print("\npython3 ./scripts/stop_all_jobs.py ---->")

if __name__ == '__main__':
    singa_auto_host = os.environ.get('SINGA_AUTO_HOST', 'localhost')
    admin_port = int(os.environ.get('ADMIN_EXT_PORT', 3000))
    user_email = SUPERADMIN_EMAIL
    user_password = os.environ.get('SUPERADMIN_PASSWORD', 'singa_auto')

    # Initialize client
    client = Client(admin_host=singa_auto_host, admin_port=admin_port)
    client.login(email=user_email, password=user_password)
    print("\nclient.stop_all_jobs(): ", client.stop_all_jobs())
示例#4
0
def seed_users(client, csv_file_path):
    with open(csv_file_path, 'rt', encoding='utf-8-sig') as f:
        reader = csv.DictReader(f)
        reader.fieldnames = [name.lower() for name in reader.fieldnames]
        for row in reader:
            email = row['email']
            password = row['password']
            user_type = row['user_type']
            try:
                pprint(client.create_user(email, password, user_type))
            except Exception as e:
                print('Failed to create user `{}` due to:'.format(email))
                print(e)


if __name__ == '__main__':
    singa_auto_host = os.environ.get('SINGA_AUTO_HOST', 'localhost')
    admin_port = int(os.environ.get('ADMIN_EXT_PORT', 3000))
    web_admin_port = int(os.environ.get('WEB_ADMIN_EXT_PORT', 3001))
    user_email = os.environ.get('USER_EMAIL', SUPERADMIN_EMAIL)
    user_password = os.environ.get('USER_PASSWORD', SUPERADMIN_PASSWORD)
    csv_file_path = os.environ.get('CSV_FILE_PATH',
                                   'examples/scripts/users.csv')

    # Initialize client
    client = Client(admin_host=singa_auto_host, admin_port=admin_port)
    client.login(email=user_email, password=user_password)

    seed_users(client, csv_file_path)