►
Description
Dagster Code locations are a collection of Dagster code and accessible by Dagster's tools, such as the CLI, Dagit, and Dagster Cloud.
A code location can be comprised of:
- A single python file
- A collection of python files
In this short tutorial, Odette Harary walks us through how to define both a single code location and multiple code locations using both the `workspace.yaml` file and `dagster_cloud.yaml` file for Dagster Open Source and Dagster cloud, respectively.
A
A
Hi
everyone,
my
name,
is
Odette
today,
I'll
be
walking
you
through
how
to
set
up
code
locations
for
your
diagster
project.
A
code
location
is
either
a
single
python
file
or
multiple
python
files
that
contain
all
of
your
different
dagster
code.
So
everything
from
your
assets
to
your
schedules
to
your
sensors
and
what
I'll
be
walking
you
through
today
is
showing
you
how
to
set
up
first,
a
single
code
location,
but
then
showing
you
how
to
add
other
code
locations
so
that
you
have
multiple
code
locations
for
your
dagster
project.
A
A
A
A
So
if
I
look
at
that
store
here,
you'll
see
that
we
have
this
new
random
asset
and
if
I
look
at
my
code
locations,
there's
that
single
code
location
there
so
that's
great.
But
what
if
we
have
multiple
code
locations?
So
what
I'm
going
to
do
is
in
addition
to
this,
my
data
pipeline
folder
over
here
I'm,
going
to
actually
add
a
new
folder,
which
has
some
machine
learning
pipelines
that
we're
going
to
add
in
so
I've
just
cleared
my
terminal
and
I'm,
going
to
paste
in
a
new
file
or
actually
a
new
folder.
A
And
what
I'm
going
to
do
is
paste
it
over
here.
So
here
we
have.
Our
ml
pipeline
you'll
see
that
there's
this
ml
assets.py
file,
which
has
different
machine
learning
assets
and
the
next
thing
I'm
going
to
do,
is
actually
create
a
new
file
called
the
workspace.yaml
file
and
you'll
be
able
to
see
a
bunch
of
different
examples
on
the
docs
for
this,
and
what
I'm
going
to
do
is
actually.
A
Walk
you
through
what
this
means
in
order
to
set
this
up
so
just
to
show
you
different
flavors
of
what
this
would
look
like.
I'll,
also
paste
in
a
new
py
file
which
just
has
a
single
asset
and
is
not
a
module.
So
what
this
has
is
load
from,
and
the
first
thing
I'm
doing
is
loading
in
my
data
pipeline
code,
location
and
you'll
see
that
this
has
both
the
module
name,
but
also
working
directory,
which
tells
it
where
to
look.
A
So
it's
actually
looking
within
this
folder
here
to
know
that
I
need
to
change
my
working
directory
in
order
to
find
this
new
module.
The
next
thing,
I'm
going
to
do,
is
add
in
this
new
machine
learning
pipeline
module.
So
that's
this
line
of
code
here
and
here
you'll
see
that
there's
no
subfolder,
so
I
just
need
to
say
that
this
is
the
code,
location
and
it'll
know
to
look
in
this
module
for
my
assets.
A
The
last
thing
I'm
going
to
do
is
show
this
is
actually
how
you
load
in
a
single
python
file,
so
you
could
have
any
mix
of
different
code
locations.
You
want,
and
here
I'm
just
saying
that
this
is
the
python
file
that
I
want
for
my
third
location
and
you'll,
see
here.
I
went
back
into
this
subdirectory
called
code
location,
so
I'm
no
longer
in
my
data
pipeline
directory.
A
So,
if
I
look
at
my
code,
locations
under
deployment
here,
you'll
see
that
we
have
not
one
but
three
different
code
locations
and
if
I
look
at
any
one
of
those
I'll
be
able
to
see
my
different
assets
as
part
of
each
of
those
code
locations.
So
congratulations.
You've
been
able
to
set
up
multiple
code
locations
with
your
decks
with
your
workspace.yaml
file
in
your
dagster
project,
for
open
source.
A
So
next
I
wanted
to
show
you
how
to
set
up
multiple
code
locations
when
you're
using
dagster
Cloud
so
you'll
see
here
that
we
have
all
of
the
same
types
of
files,
but
instead
of
a
workspace.yaml
file,
we
actually
have
our
dagster
Cloud
diamo
file.
So
if
I
open
that
up,
I
have
already
added
in
my
second
code
location
here
so
same
as
before,
I
have
my
data
Pipeline
and
I.
Have
my
random
assets
up
py
file.
I
could
also
add
in
that
same
machine
learning,
Pipeline
and
that
will
work
similarly.
A
A
This
is
my
dagster
cloud
UI
and
you'll
notice.
The
same
type
of
pattern,
so
I
have
my
Dax
data
pipelines
over
here,
as
well
as
this
random
asset
and
you'll,
see
here
that
this
has
a
package
name,
and
this
has
my
py
file
and
I'm
able
to
see
all
of
my
different
Assets
in
here.
We
hope
you
enjoyed
learning
about
code
locations
within
dagster
and
looking
forward
to
seeing
all
the
different
projects
you'll
be
creating.
Thank
you.