Conflicting Definitions when using Op factory I'm...
# ask-community
s
Conflicting Definitions when using Op factory I'm upgrading from 0.13.16 to 0.14.7 and I'm getting an error for code that was working,
Copy code
Conflicting definitions found in repository with name '_login'. Op/Graph/Solid definition names must be unique within a repository. OpDefinition is defined in job 'abc' and in job 'xyz'.
I'm using a factory to create the op in question, which looks something like this,
Copy code
def login(username, password):
    @dagster.op
    def _login():
        do_the_login(username, password)
    return _login
I use the op in a graph like this,
Copy code
@dagster.graph
def g():
    login("abc", "xyz")()
And then that graph gets used in multiple jobs. I could add a unique ID to the name of the op, but that feels like an anti-pattern.
c
Hi Stefan, the easiest solution is to pass a unique name to every definition of the
_login
op. The
_login
op currently has many duplicate definitions, which Dagster doesn't allow in order to distinguish between ops that are invoked in many places within a repository.
s
@claire This is exactly what I'm doing. I started with postfixing each op name that was being duplicated with a UID, but that was not a nice solution because the job names don't read well. I then moved to "namespacing" the
ops
that get duplicated by passing an identifier (the job name) into the op factory so that the op's name includes the job it belongs to. I'm OK with this solution for now, although I can see a situation where I might have
op
name clashes in the future. It's my plan to build libraries of reusable ops and it's quite possible that two ops in different libraries could be called
login.
If two of those ops are being used in the same job, prefixing them with the job name would be insufficient to distinguish between them. You could perhaps argue that
login
is a bad name for an op.
c
Yeah, another option would be to prefix the ops with the name of the library they belong in