Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompilerNode interface #757

Merged
merged 11 commits into from
Jan 14, 2022
Merged

CompilerNode interface #757

merged 11 commits into from
Jan 14, 2022

Conversation

pretty-wise
Copy link

@pretty-wise pretty-wise commented Jan 3, 2022

Changes:

  • introduce CompilerNode interface that is used by all compiler-running binaries
  • create ubercompiler binary
  • share AssetRegistry between compilers within the same process

Code dependency graph:

Below illustrates code dependencies of data-compilers and executables that use data-build to trigger those compilers.

            ---------       ---------   ---------
            | a.lib |       | b.lib |   | c.lib |
            ---------       ---------   ---------
                 |             /  \      |
            -------------------- --------------------
            | compiler-a2b.lib | | compiler-b2c.lib |
            -------------------- --------------------
          /                    \/         |
         |                     /\         |
         |  -------------------- --------------------
         |  | compiler-b2c.exe | | ubercompiler.lib |
         |  -------------------- --------------------
         |            |            |        \
--------------------  |            |      --------------------
| compiler-a2b.exe |  |            |      | ubercompiler.exe |
--------------------  |            |      --------------------
          A           |            |
          |           |            |
          |           |            |
          |           |            |
          |           |            |
         ==================    ==================    
         | DATA-BUILD.exe |    | EDITOR-SRV.exe |    
         ==================    ================== 

data_build::DataBuild

data-build.exe and editor-srv.exe are currently the entry points to building data. They do this through DataBuild interface which is responsible for creating the build graph and triggering data compilation in the right order.

  • data-build.exe - currently uses each compiler as standalone executable
  • editor-srv.exe - currently uses in-process compilers by linking with ubercompiler.lib

data_compiler::compiler_node::CompilerNode

This is an interface used by each binary that does data compilation (such as compiler-a2b.exe, ubercompiler.exe, data-build.exe, editor-srv.exe). This will help us treat each binary as a node in a "compilation network" when tackling the distribution of building game data.

@pretty-wise pretty-wise self-assigned this Jan 3, 2022
@pretty-wise pretty-wise mentioned this pull request Jan 3, 2022
11 tasks
Copy link

@aganea aganea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

let mut iter = s.split(|c| c == '-');
let from = iter
.next()
.ok_or_else(|| "Z".parse::<u64>().expect_err("ParseIntError"))?;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always wondered about this, can't we just return a true std::num::ParseIntError here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I remember it is not possible to create ParseIntError (see rust-lang/rfcs#1143).

I was actually thinking we can just use () as the Err type since it's not that relevant/useful I think. But that would need a separate PR.

let _hashes = command.execute(&exe_path).expect("hash list");
// get all hashes
let command = CompilerHashCmd::new(&common::test_env(), None);
let hashes = command.execute(&exe_path).expect("hash list");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to debug this kind of data-build/compiler tests in the past few weeks, and I was wondering if we could have the corresponding compiler embedded (eventually) in the test executable? Plus, the other issue is that there's no explicit link to the compiler .exe itself, which means that this test & the compiler .exe can be out of date.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I feel your pain. I either run cargo build before running any tests. Or simply run make test.

As for embedding compiler - this test is specifically testing calling an external executable - which is a path that we still support.

The issue is that cargo does not provide binary dependencies. There is an rust-lang/rfcs#3028 to add it which would help us solve this problem.

All this indeed creates problems. Basically you need to at least run cargo build -p compiler-* for some tests to make sense. This is what we have the build machines configured to do; and make test does the same thing.

@pretty-wise pretty-wise force-pushed the compiler-interface branch 4 times, most recently from a57dc03 to a37ea53 Compare January 12, 2022 19:54
@pretty-wise pretty-wise added this to In progress in Data Pipeline Jan 12, 2022
@pretty-wise pretty-wise changed the title Compiler interface (WIP) CompilerNode interface Jan 13, 2022
@pretty-wise pretty-wise merged commit fa68895 into main Jan 14, 2022
Data Pipeline automation moved this from In progress to Done Jan 14, 2022
@pretty-wise pretty-wise deleted the compiler-interface branch January 15, 2022 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants