How to use the signac.contrib.get_project function in signac

To help you get started, we’ve selected a few signac examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glotzerlab / signac / examples / lennard-jones / submit.py View on Github external
def main(args):
    project = get_project()
    for state_point in state_points:
        project.job_queue.submit(run_job, state_point)
github glotzerlab / signac / signac / contrib / script.py View on Github external
def show_log(args):
    formatter = logging.Formatter(
        fmt = args.format,
        #datefmt = "%Y-%m-%d %H:%M:%S",
        style = '{')
    project = get_project()
    showed_log = False
    for record in project.get_logs(
            level = args.level, limit = args.lines):
        print(formatter.format(record))
        showed_log = True
    if not showed_log:
        print("No logs available.")
github glotzerlab / signac / signac / contrib / init_project.py View on Github external
def check_for_existing_project(args):
    try:
        project = get_project()
        root_dir = project.root_directory()
    except (LookupError, FileNotFoundError, NotADirectoryError, KeyError):
        pass
    else:
        if os.path.abspath(root_dir) == os.path.abspath(args.directory):
            print("Project in directory '{}' already exists. "
                  "Use '-f' or '--force' argument to ignore this warning and "
                  "create a project anyways. This will lead to potential "
                  "data loss!".format(os.path.abspath(args.directory)))
            return True
    return False
github glotzerlab / signac / examples / lennard-jones / analyze.py View on Github external
def main():
    project = get_project()
    docs = project.find()
    for doc in docs:
        print(doc)
github glotzerlab / signac / signac / contrib / script.py View on Github external
def run_checks(args):
    project = get_project()
    encountered_error = False
    checks = [
        ('global configuration',
        check.check_global_config),
        ('database connection',
        check.check_database_connection)]
    try:
        project_id = project.get_id()
    except LookupError:
        print("Current working directory is not configured as a project directory.")
    else:
        print("Found project: '{}'.".format(project_id))
        checks.extend([
            ('project configuration (offline)',
            check.check_project_config_offline)])
        checks.extend([
github glotzerlab / signac / signac / contrib / check.py View on Github external
def check_project_config_online_readonly():
    project = get_project()
    project.get_id()
    list(project.find(limit=1))
    return True
github glotzerlab / signac / signac / contrib / admin.py View on Github external
def get_project_(args):
    return get_project()