Bỏ qua

Using Global Project

Warning

The current page still doesn't have a translation for this language.

But you can help translating it: Contributing.

In this guide, we will introduce the concept of global projects and provide step-by-step instructions on how to create, link, and manage global projects within your standard projects. Global projects allow for shared resources and configurations, ensuring consistency across multiple standard projects. For a detailed overview of global projects, refer to the Global Projects Section.

Make A Global Project

See here for a detailed overview.

In this tutorial, we will focus on making a Global Project from our DATAMIMIC's Custom Components Demo.

  1. From the DATAMIMIC Demo Store, Clone our Demo called Custom Components.
  2. Navigate to the Cloned Demo's Project Settings.
  3. Click on the "Globe" icon to make this project into a global project.

This Project will now become a Global Project, which means you any other standard project you created can have an option to link to this Global Project.

  1. Create a new empty DATAMIMIC Project.
  2. Navigate to the newly created empty Project Settings.
  3. Choose the Global Projects tab, Click on Add and select the Global Project Custom Component we just created.
  4. Navigate back to the Editor.
Add Global Project
Link Global Project

In the File Editor, you will see that our standard project will now include files from the Custom Components Global Project. However these files will only be available as read-only access. These files will have a special icon and will be read-only. If you wish to make changes to these files, see here

Note

Note that in our Global Project and Standard Project both have a datamimic.xml file. However, when after link them together, the content of the datamimic.xm file in the new project will not automatically update to match the global project’s datamimic.xml. This is because, when merging project files, the standard project’s files take precedence in case of name duplication. For more details, refer to our Best Practices for managing global project.

Generate Project

Our Global Project Custom Components have files that contains our Custom Converters, Generators. If you wish to learn more how to create these by yourself, check out this section. For now, we will use these in our current project.

  1. Edit the datamimic.xml file with:
datamimic.xml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<setup numProcess="4">

    <include uri="conf/base.properties"/>
    <memstore id="mem"/>

    <!-- Load scripts into the global context using <execute> -->
    <execute uri="script/generator.scr.py"/>
    <execute uri="script/converter.scr.py"/>

    <!-- Include the model using multiprocessing with custom generators, which use local imports -->
    <include uri="1_generator_multi.xml"/>

    <!-- Include the model using multiprocessing with custom converters -->
    <include uri="2_converter_multi.xml"/>

    <!-- Load scripts with global imports into the context. Note: executing this before
    <include uri="1_generator_multi.xml"/> will cause an error because multithreading and
    global imports are not supported together -->
    <execute uri="script/generator_glob.scr.py"/>

    <!-- Include the model using single processing with custom generators, which use global imports -->
    <include uri="3_generator_global_single.xml"/>

</setup>
  1. Edit the base config file with:
base
1
global_count=10
  1. Click on Generate.
  2. Go to the Task view for generated model and check out the result after the generating process is finished.

Our DATAMIMIC model is now designed to include predefined custom generators and converters from the global project. This approach allows you to utilize global projects to manage advanced use cases, such as having shared generators, scripts, or converters across multiple standard projects. By using a global project, you can establish a consistent logic that can be replicated in each standard project, streamlining your workflow and ensuring uniformity.

Recap

In this guide, we introduced the concept of global projects and demonstrated how to create, link, and manage them within your standard projects using DATAMIMIC. Here’s a summary of the key steps:

  1. Create a Global Project:
    • We began by cloning a demo project called Custom Components from the DATAMIMIC Demo Store.
    • We converted this project into a global project by navigating to the Project Settings and clicking the “Globe” icon.
  2. Link a Global Project to a Standard Project:
    • We created a new empty DATAMIMIC project and accessed its Project Settings.
    • Under the Global Projects tab, we added the Custom Components global project.
    • We returned to the File Editor, where we observed that files from the global project appeared as read-only with a special icon.
  3. Generate Project:
    • We edited the datamimic.xml file to include custom generators and converters from the global project.
    • We updated the base config file and then clicked Generate to apply the custom configurations.
    • We reviewed the results in the Task view after the generation process was completed.