# Hot-reloading tasks in spaces

**URL:** <https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233>\
**Category:** Server (Hub) / Explorer\
**Created:** [December 9, 2021, 11:23am UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233 "2021-12-09T11:23:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [December 9, 2021, 11:23am UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/1 "2021-12-09T11:23:24Z")

</div>

In version 5.1.1 we've added the ability to hot-reload tasks in a spaces without restarting the Server.

![image](https://community.easymorph.com/uploads/default/original/2X/f/f9199868b6a12e74145a20ecff30dfd0dbdc82eb.png)

The list in tab "Spaces" now has buttons for reloading the list of tasks in spaces without restarting the Server. This enables promotion of tasks from one space (e.g. "dev") to another (e.g. "prod") using a version control system such as git or simply by copying the respective XML files from one space to another. After copying/promotion, press the "Reload tasks" button to make the Server use the updated task definitions in the space.

---

<div class="post-metadata">

**Author:** ![reynsnivea](https://community.easymorph.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@reynsnivea](https://community.easymorph.com/u/reynsnivea)\
**Post date:** [December 13, 2021, 10:51am UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/2 "2021-12-13T10:51:24Z")

</div>

Hi Dmitry,

That's great ! Will there be a copy paste button or something alike to make the copy of tasks from one space to another more user friendly ?

Thanks  
Nikolaas

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [December 13, 2021, 12:06pm UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/3 "2021-12-13T12:06:11Z")

</div>

Hi Nikolaas,

no plans for that. I would suggest making a Server task for copying tasks from one space to another. Such a task can be triggered from the Server UI, or using ems-cmd, or using the "EasyMorph Server command" action.

---

<div class="post-metadata">

**Author:** ![reynsnivea](https://community.easymorph.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@reynsnivea](https://community.easymorph.com/u/reynsnivea)\
**Post date:** [May 28, 2022, 10:20am UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/4 "2022-05-28T10:20:29Z")

</div>

Hi Dmitry,

So when we want to move a task from dev space to prod space we do the following:

- Copy the XML of the task from dev space into prod space.
- In the prod space click the reload button.

When we copy the XML from dev space to prod space, will it pose problems because the two ID's of the files will be the same for a moment ?

Thanks  
Nikolaas

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [May 30, 2022, 10:06am UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/5 "2022-05-30T10:06:26Z")

</div>

Hi Nikolaas,

that shouldn't be a problem. Tasks in different spaces can have the same ID.

---

<div class="post-metadata">

**Author:** ![reynsnivea](https://community.easymorph.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@reynsnivea](https://community.easymorph.com/u/reynsnivea)\
**Post date:** [June 23, 2022, 12:25pm UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/6 "2022-06-23T12:25:15Z")

</div>

@dgudkov

I find your suggestion of using git very interesting. I use it for my EasyMorph flows development but not for tasks on EM-server.

How can we use git for migrating the tasks between spaces ? I suppose the following workflow:

- create a git repo in the easymorph server space where the task XML-files reside. Does the .git folder create problems for task execution ?

- Pull the latest version in the target space to get all tasks in the target space en then press the hot-reload tasks button.

- How can we also automate the overwrite of parameter values. For example we have a database parameter that we have to overwrite in the production environment. We also have a lot of other params that we have to overwrite when moving to prod. So my question: when we pull a new version of the tasks with git, it will have the param values from dev and we would like to automatically overwrite them with the prod values.  
One idea that comes to my mind is that we could create 1 parameter 'environment' and all other parameters are calculated parameters that change as a function of the parameter 'environment'. When we want to apply this to our current tasks, we have to change all our parameters to calculated params. So that's quite a workload...  
Any suggestions ?

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 23, 2022, 3:47pm UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/7 "2022-06-23T15:47:51Z")

</div>

> [@reynsnivea](#):
>
> create a git repo in the easymorph server space where the task XML-files reside. Does the .git folder create problems for task execution ?

That shouldn't be a problem. It if becomes a problem, we'll fix that.

> [@reynsnivea](#):
>
> How can we also automate the overwrite of parameter values. For example we have a database parameter that we have to overwrite in the production environment. We also have a lot of other params that we have to overwrite when moving to prod. So my question: when we pull a new version of the tasks with git, it will have the param values from dev and we would like to automatically overwrite them with the prod values.  
> One idea that comes to my mind is that we could create 1 parameter ‘environment’ and all other parameters are calculated parameters that change as a function of the parameter ‘environment’. When we want to apply this to our current tasks, we have to change all our parameters to calculated params. So that’s quite a workload…  
> Any suggestions ?

If you need to specify environment-specific variables via parameters, consider using [the "Shared memory"](https://community.easymorph.com/t/preview-shared-memory/2892) instead of task parameters. The Shared Memory is a more appropriate place to store environment-specific settings.

---

<div class="post-metadata">

**Author:** ![reynsnivea](https://community.easymorph.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@reynsnivea](https://community.easymorph.com/u/reynsnivea)\
**Post date:** [June 23, 2022, 7:23pm UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/8 "2022-06-23T19:23:23Z")

</div>

@dgudkov

Thanks for the response. How should we use the shared memory exactly to change the database connection from DEV to PROD for instance ?

Do you mean something like the example below?  
Here I created under a specific key "development" 3 values for db connections.  
I list the keys using a parameter called "environment".

Then I removed the first item in the key path so that it works in other environments.

Finally I use the values to pass them to the module that needs to run.

So with this approach, one could move from dev to prod by just switching 1 parameter "environment".

 ![image](https://community.easymorph.com/uploads/default/original/2X/0/0e27fae166b6811a99504a02f490a717fa018486.png)

 ![image](https://community.easymorph.com/uploads/default/original/2X/d/d54755c62eb6d033ec919ef602927fa619f70e3a.png)

For example when I change the parameter to production, I get:

 ![image](https://community.easymorph.com/uploads/default/original/2X/9/9408bcb60a2b4dbaa52c6cc5f96d54b6725d41a4.png)

Kind regards  
Nikolaas

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 23, 2022, 7:40pm UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/9 "2022-06-23T19:40:30Z")

</div>

Recall a value from the shared memory using the "Shared memory" action. Then use the "first column value" mode to use it in action properties.

As a general solution compatible with your current parameters, you can create a new start module that will pull values from the shared memory and then call the current start module with the "Call" action and assign its parameters with values from the shared memory.

Notice that you can put several actions "Shared memory: Recall" one after another and each of them will add a new column.

---

<div class="post-metadata">

**Author:** ![reynsnivea](https://community.easymorph.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@reynsnivea](https://community.easymorph.com/u/reynsnivea)\
**Post date:** [June 24, 2022, 6:27pm UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/10 "2022-06-24T18:27:02Z")

</div>

@dgudkov

A suggestion: currently it is not possible to add a comment with each key/value pair. In parameters we can write a comment to remember ourselves what the purpose of the parameter is. Maybe a comment field for the shared memory could be handy. When we will use this as environment variables, we will need this I guess.

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [June 25, 2022, 9:34pm UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/11 "2022-06-25T21:34:40Z")

</div>

I don't think comments are necessary for values in Shared Memory. You can just add one more record with a comment. E.g.

path/value = 123  
path/comment = "example"

OR

path = 123  
path/comment = "example"

Shared Memory is a very flexible mechanism. With a bit of creativity, it can accommodate many scenarios.

---

<div class="post-metadata">

**Author:** ![reynsnivea](https://community.easymorph.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@reynsnivea](https://community.easymorph.com/u/reynsnivea)\
**Post date:** [June 26, 2022, 6:34am UTC](https://community.easymorph.com/t/hot-reloading-tasks-in-spaces/3233/12 "2022-06-26T06:34:08Z")

</div>

Ok thanks. That's a good suggestion !
