Skip to content

filelockops

filelockops

module for dagster ops regarding filelocks

Classes

Functions

acquire_locks

acquire_locks(context)

op for acquiring locks

Source code in niceml/dagster/ops/filelockops.py
@op(config_schema=dict(filelock_dict=HydraMapField(FileLock)))
def acquire_locks(context: OpExecutionContext):
    """op for acquiring locks"""
    op_config = json.loads(json.dumps(context.op_config))
    instantiated_op_config = instantiate(op_config, _convert_=ConvertMode.ALL)
    filelock_dict = instantiated_op_config["filelock_dict"]
    for filelock in filelock_dict.values():
        filelock.acquire()
    return filelock_dict

clear_locks

clear_locks(context)

op for clearing locks

Source code in niceml/dagster/ops/filelockops.py
@op(config_schema=dict(filelock_dict=HydraMapField(FileLock)))
def clear_locks(context: OpExecutionContext):
    """op for clearing locks"""
    op_config = json.loads(json.dumps(context.op_config))
    instantiated_op_config = instantiate(op_config, _convert_=ConvertMode.ALL)
    filelock_dict = instantiated_op_config["filelock_dict"]
    for filelock in filelock_dict.values():
        filelock.force_delete()

release_locks

release_locks(_, filelock_dict)

op for releasing locks

Source code in niceml/dagster/ops/filelockops.py
@op
def release_locks(_: OpExecutionContext, filelock_dict: dict):
    """op for releasing locks"""
    for filelock in filelock_dict.values():
        filelock.release()